[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] [PATCH] syslogd: Fix possible memory corruption whil
From: |
Mats Erik Andersson |
Subject: |
Re: [bug-inetutils] [PATCH] syslogd: Fix possible memory corruption while reading configuration file. |
Date: |
Thu, 2 Apr 2015 11:49:20 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Wednesday den 1 April 2015 klockan 17:37 skrev Alfred M. Szmidt detta:
>
> - strcpy (cline, p);
> + bcopy (p, cline, strlen (p) + 1);
>
> Thanks! I'll read the bug report tomorrow -- I think there is more
> than catches the eye. Leading whitespace before the selector is not
> valid syntax for syslog.conf AFAIR.
>
> Also, bcopy was marked deprecated in POSIX 2001, and removed in 2008;
> memcpy is always prefered. And in this case, strncpy would be more
> apt.
Observe here, that the result of memcpy() is undefined in case of
overlapping memory locations, which is not the case of bcopy().
Instead, memmove() is the function to consider.