← Commit list

92657d484

Denis Vlasenko
Denis Vlasenko
2008-02-19
FAILED Duration: 18s

Subject

syslogd: tighten up hostname handling.

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

sysklogd/syslogd.c+4 -4
@@ -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);