* ext.c (regex_command): Additional check to prevent reading

unallocated memory when matching "shell/".  Found by Valgrind.
This commit is contained in:
Pavel Roskin 2002-07-30 05:39:48 +00:00
parent bda707e46b
commit b698076e0e
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2002-07-30 Pavel Roskin <proski@gnu.org>
* ext.c (regex_command): Additional check to prevent reading
unallocated memory when matching "shell/". Found by Valgrind.
2002-07-29 Pavel Roskin <proski@gnu.org>
* setup.c: Eliminate all PORT* macros.

View File

@ -472,9 +472,9 @@ file as an example of how to write it.\n\
found = 1;
} else if (!strncmp (p, "shell/", 6)) {
p += 6;
if (*p == '.') {
if (!strncmp (p, filename + file_len - (q - p),
q - p))
if (*p == '.' && file_len >= (q - p)) {
if (file_len >= (q - p) &&
!strncmp (p, filename + file_len - (q - p), q - p))
found = 1;
} else {
if (q - p == file_len && !strncmp (p, filename, q - p))