ruby: fix wrong memory access in catMatch

fuzz target reports canMatch access wrong memory
area when php-anonymous_functions.d/input.php is
given as input.

This patch fixes it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
This commit is contained in:
Masatake YAMATO 2015-05-13 01:38:46 +09:00 committed by Colomban Wendling
parent a71dbcbeca
commit 68322fcb54

View File

@ -81,6 +81,11 @@ static vString* stringListToScope (const stringList* list)
static boolean canMatch (const unsigned char** s, const char* literal)
{
const int literal_length = strlen (literal);
const int s_length = strlen ((const char *)*s);
if (s_length < literal_length)
return FALSE;
const unsigned char next_char = *(*s + literal_length);
if (strncmp ((const char*) *s, literal, literal_length) != 0)
{