diff options
author | Andrii Kroitor <an.kroitor@samsung.com> | 2015-01-29 21:17:00 +0100 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-01-29 21:17:05 +0100 |
commit | b457dff840ff1e0e1c278b9aa492628f025422c3 (patch) | |
tree | f2f67d85772eff31741b6a8748c7fc99ae9f9b75 | |
parent | 4a14bbd0f5cadf35b177e4d16515122bf7d702ec (diff) | |
download | efl-b457dff840ff1e0e1c278b9aa492628f025422c3.tar.gz |
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>
-rw-r--r-- | src/lib/evil/evil_string.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/evil/evil_string.c b/src/lib/evil/evil_string.c index 11121723f0..7d7d88c13a 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) 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++) { |