#640215 userlist: Incorrectly shortened locale field.

Package:
cfingerd
Source:
cfingerd
Description:
configurable finger daemon
Submitter:
Mats Erik Andersson
Date:
2011-09-03 12:36:05 UTC
Severity:
minor
#640215#5
Date:
2011-09-03 12:32:04 UTC
From:
To:
The userlist executable wastes four characters in
mangling 'ut->ut_host' into 'tty_list[#].locale'.
The wrong macro was use in testing the length.

One could also imagining raising the value of
ULIST_LOCALE in order to handle most cases of
numerical IPv6 addresses (when the UTMP client
could not resolve into a host name) without
truncating it in the printed line. Increasing
the length would change the direct correspondence
with printout by 'last', but could still be
evaluated.

Best regards,
  Mats Erik Andersson, DM


Description: Use full length of field 'locale'.
 Test length of 'ut->ut_host' against the available
 space ULIST_LOCALE for best information content.
--- cfingerd-1.4.3.debian/userlist/initialize.c
+++ cfingerd-1.4.3/userlist/initialize.c
@@ -76,7 +76,7 @@
 	    if (*cp == ':')
 		cp++;
 	    strncpy(tty_list[times_on].locale, cp, ULIST_LOCALE);
-	    if (strlen ((char *) ut->ut_host) > ULIST_LINE)
+	    if (strlen ((char *) ut->ut_host) > ULIST_LOCALE)
 		if ((cp = strrchr(tty_list[times_on].locale, '.')) != NULL)
 		    *cp = '\0';
 	    strncpy(tty_list[times_on].line, (char *) ut->ut_line, ULIST_LINE);