projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e8419c9
)
syslogd: tighten up hostname handling.
author
Denis Vlasenko
<vda.linux@googlemail.com>
Tue, 19 Feb 2008 01:10:20 +0000
(
01:10
-0000)
committer
Denis Vlasenko
<vda.linux@googlemail.com>
Tue, 19 Feb 2008 01:10:20 +0000
(
01:10
-0000)
sysklogd/syslogd.c
patch
|
blob
|
history
diff --git
a/sysklogd/syslogd.c
b/sysklogd/syslogd.c
index dc5e6250a2b7e6fb514311438ca1d6a671a8a297..bed18168cb825b7fd4b3d50bc572091389e12bca 100644
(file)
--- a/
sysklogd/syslogd.c
+++ b/
sysklogd/syslogd.c
@@
-649,10
+649,10
@@
int syslogd_main(int argc, char **argv)
/* Store away localhost's name before the fork */
gethostname(G.localHostName, sizeof(G.localHostName));
- p = strchr(G.localHostName, '.');
- if (p) {
-
*p
= '\0';
- }
+ /* "It is unspecified whether the truncated hostname
+ * will be null-terminated". Idiots! */
+
G.localHostName[sizeof(G.localHostName) - 1]
= '\0';
+ *strchrnul(G.localHostName, '.') = '\0';
if (!(option_mask32 & OPT_nofork)) {
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);