summaryrefslogtreecommitdiff
path: root/src/lib/evil/evil_string.c
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2015-01-29 21:17:00 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-01-29 21:17:05 +0100
commitb457dff840ff1e0e1c278b9aa492628f025422c3 (patch)
treef2f67d85772eff31741b6a8748c7fc99ae9f9b75 /src/lib/evil/evil_string.c
parent4a14bbd0f5cadf35b177e4d16515122bf7d702ec (diff)
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>
Diffstat (limited to 'src/lib/evil/evil_string.c')
-rw-r--r--src/lib/evil/evil_string.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/evil/evil_string.c b/src/lib/evil/evil_string.c
index 1112172..7d7d88c 100644
--- a/src/lib/evil/evil_string.c
+++ b/src/lib/evil/evil_string.c
@@ -58,7 +58,9 @@ char *strcasestr(const char *haystack, const char *needle)
58 return NULL; 58 return NULL;
59 59
60 length_needle = strlen(needle); 60 length_needle = strlen(needle);
61 length_haystack = strlen(haystack) - length_needle + 1; 61 length_haystack = strlen(haystack);
62 if (length_haystack < length_needle) return NULL;
63 length_haystack = length_haystack - length_needle + 1;
62 64
63 for (i = 0; i < length_haystack; i++) 65 for (i = 0; i < length_haystack; i++)
64 { 66 {