[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Syslog bug
From: |
Ludovic Courtès |
Subject: |
Re: Syslog bug |
Date: |
Wed, 01 Apr 2015 21:51:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Alex Kost <address@hidden> skribis:
> Wow, I admire how deep you dig! Your patch does some funny thing, it
> "moves" corruption to another place. Here is the output:
>
> # ./syslogd --debug --rcfile /tmp/syslog-with-leading-spaces.conf
> init
> cfline(*.alert;auth.notice;authpriv.none /dev/console
> sole)
Oops, indeed, I had it too but hadn’t noticed. :-)
This is because the bcopy call didn’t copy the trailing zero, which is
fixed by adding “+ 1”:
diff --git a/src/syslogd.c b/src/syslogd.c
index 7af10f3..aaf02a4 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -1971,7 +1971,7 @@ load_conffile (const char *filename, struct filed **nextp)
if (*p == '\0' || *p == '#')
continue;
- strcpy (cline, p);
+ bcopy (p, cline, strlen (p) + 1);
/* Cut the trailing spaces. */
for (p = strchr (cline, '\0'); isspace (*--p);)
> --- a/src/syslogd.c
> +++ b/src/syslogd.c
> @@ -1971,7 +1971,7 @@ load_conffile (const char *filename, struct filed
> **nextp)
> if (*p == '\0' || *p == '#')
> continue;
>
> - strcpy (cline, p);
> + strncpy (cline, p, strlen (cline));
I guess this worked by chance: it does not copy the trailing zero, and
it doesn’t address the overlapping-memory-regions issue.
> A side note: compilation of inetutils failed for me complaining about
> missing "help2man". It finished successfully after I had added
> "help2man" to native-inputs.
That’s because the patch modifies the source of an executable for which
a man page is generated.
Thanks for your feedback! I’ll report the issue upstream.
Ludo’.
- Re: Syslog bug, Alex Kost, 2015/04/01
- Re: Syslog bug,
Ludovic Courtès <=