barbieri pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=13cd93f729bd2be8b5ab84d4a1706c365acc7cb3
commit 13cd93f729bd2be8b5ab84d4a1706c365acc7cb3 Author: Gustavo Sverzut Barbieri <barbi...@profusion.mobi> Date: Wed Mar 29 10:11:01 2017 -0300 evil_string: fix strndup() for non-NULL terminated strings. If the given string is not null-terminated, then strlen() will go out of boundaries, we must limit the lookup to given 'n' parameter. To do so use strnlen(), that is a strlen() bounded by a maximum size. --- src/lib/evil/evil_string.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/evil/evil_string.c b/src/lib/evil/evil_string.c index 634565b..4534b72 100644 --- a/src/lib/evil/evil_string.c +++ b/src/lib/evil/evil_string.c @@ -18,10 +18,9 @@ char * strndup(const char *str, size_t n) { - size_t slen = strlen(str); + size_t slen = strnlen(str, n); char *ret; - if (slen > n) slen = n; ret = malloc (slen + 1); if (!ret) return NULL; --