[BusyBox 0001158]: logger truncates user names
bugs at busybox.net
bugs at busybox.net
Fri Jan 12 14:28:11 PST 2007
The following issue has been CLOSED
======================================================================
http://busybox.net/bugs/view.php?id=1158
======================================================================
Reported By: espakman
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 1158
Category: Other
Reproducibility: always
Severity: minor
Priority: normal
Status: closed
Resolution: open
Fixed in Version:
======================================================================
Date Submitted: 01-12-2007 11:26 PST
Last Modified: 01-12-2007 14:28 PST
======================================================================
Summary: logger truncates user names
Description:
The logger applet truncates usernames. Example (as user "root"):
./busybox logger "test"
Contents of the logfile:
Jan 12 19:11:45 enterprise roo: test
The fix is simple but ugly:
diff -urpN busybox.orig/sysklogd/logger.c busybox/sysklogd/logger.c
--- busybox.orig/sysklogd/logger.c 2007-01-12 09:20:07.000000000
+0100
+++ busybox/sysklogd/logger.c 2007-01-12 20:12:52.000000000 +0100
@@ -88,7 +88,7 @@ int logger_main(int argc, char **argv)
RESERVE_CONFIG_BUFFER(name, 80);
/* Fill out the name string early (may be overwritten later) */
- bb_getpwuid(name, geteuid(), sizeof(name));
+ bb_getpwuid(name, geteuid(), 80);
/* Parse any options */
getopt32(argc, argv, "p:st:", &opt_p, &opt_t);
@@ -96,7 +96,7 @@ int logger_main(int argc, char **argv)
if (option_mask32 & 0x2) /* -s */
i |= LOG_PERROR;
if (option_mask32 & 0x4) /* -t */
- safe_strncpy(name, opt_t, sizeof(name));
+ safe_strncpy(name, opt_t, 80);
openlog(name, i, 0);
if (ENABLE_FEATURE_CLEAN_UP)
RELEASE_CONFIG_BUFFER(name);
It looks like the use of RESERVE_CONFIG_BUFFER and sizeof() is mutual
exclusive.
======================================================================
----------------------------------------------------------------------
vda - 01-12-07 14:28
----------------------------------------------------------------------
Fixed prior to rev 17263, thanks
Issue History
Date Modified Username Field Change
======================================================================
01-12-07 11:26 espakman New Issue
01-12-07 11:26 espakman Status new => assigned
01-12-07 11:26 espakman Assigned To => BusyBox
01-12-07 14:28 vda Status assigned => closed
01-12-07 14:28 vda Note Added: 0001985
======================================================================
More information about the busybox-cvs
mailing list