1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Be sure to not use strlen with NULL pointer.

This commit is contained in:
Simo Sorce 0001-01-01 00:00:00 +00:00
parent 402639926f
commit 53803b0087

View File

@ -391,7 +391,8 @@ static void sys_utmp_update(struct utmp *u, const char *hostname, BOOL claim)
getutmpx(u, &ux);
#if defined(HAVE_UX_UT_SYSLEN)
ux.ut_syslen = strlen(hostname) + 1; /* include end NULL */
if (hostname) ux.ut_syslen = strlen(hostname) + 1; /* include end NULL */
else ux.ut_syslen = 0;
#endif
safe_strcpy(ux.ut_host, hostname, sizeof(ux.ut_host)-1);