Report to syslog strings that start with NUL; prevents negative index
array access. Ray Lai of OpenBSD via Björn Sandell. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19212 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -120,6 +120,10 @@ read_limits_conf(const char *file, const struct passwd *pwd)
|
|||||||
|
|
||||||
lineno++;
|
lineno++;
|
||||||
|
|
||||||
|
if(buf[0] == '\0') {
|
||||||
|
syslog(LOG_ERR, "%s: line %d: NUL character", file, lineno);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(buf[strlen(buf) - 1] != '\n') {
|
if(buf[strlen(buf) - 1] != '\n') {
|
||||||
/* file did not end with a newline, figure out if we're at
|
/* file did not end with a newline, figure out if we're at
|
||||||
the EOF, or if our buffer was too small */
|
the EOF, or if our buffer was too small */
|
||||||
|
Reference in New Issue
Block a user