forked from enlightenment/efl
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:
parent
4a14bbd0f5
commit
b457dff840
|
@ -58,7 +58,9 @@ char *strcasestr(const char *haystack, const char *needle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
length_needle = strlen(needle);
|
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++)
|
for (i = 0; i < length_haystack; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue