Be sure to not use strlen with NULL pointer.
authorSimo Sorce <idra@samba.org>
Fri, 15 Jun 2001 08:00:36 +0000 (08:00 +0000)
committerSimo Sorce <idra@samba.org>
Fri, 15 Jun 2001 08:00:36 +0000 (08:00 +0000)
(This used to be commit 53803b008717e8606b347ed8baab78121c6e9657)

source3/smbd/utmp.c

index 486c7fe06ee9f2bd2162e00b5da0d1d0082a6f3e..f79cd43c5b176ff9d1dac0952ea772729fa1e864 100644 (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);