evil: fix SEGFAULT in strcasestr

Summary:
there was an unsigned int underflow.

@fix

Test Plan: strcasestr("a", "bbb");

Reviewers: cedric, raster, Hermet, seoz

Subscribers: cedric, reutskiy.v.v

Differential Revision: https://phab.enlightenment.org/D1909

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Andrii Kroitor 2015-01-29 21:17:00 +01:00 committed by Cedric BAIL
parent 4a14bbd0f5
commit b457dff840
1 changed files with 3 additions and 1 deletions

View File

@ -58,7 +58,9 @@ char *strcasestr(const char *haystack, const char *needle)
return NULL;
length_needle = strlen(needle);
length_haystack = strlen(haystack) - length_needle + 1;
length_haystack = strlen(haystack);
if (length_haystack < length_needle) return NULL;
length_haystack = length_haystack - length_needle + 1;
for (i = 0; i < length_haystack; i++)
{