diff --git a/src/ChangeLog b/src/ChangeLog index d820d7f1b..2c215dce5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-07-30 Pavel Roskin + + * ext.c (regex_command): Additional check to prevent reading + unallocated memory when matching "shell/". Found by Valgrind. + 2002-07-29 Pavel Roskin * setup.c: Eliminate all PORT* macros. diff --git a/src/ext.c b/src/ext.c index 217df9e58..c624b5385 100644 --- a/src/ext.c +++ b/src/ext.c @@ -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))