diff --git a/legacy/eina/src/lib/eina_unicode.c b/legacy/eina/src/lib/eina_unicode.c index fc72ed6bbd..4f0431b976 100644 --- a/legacy/eina/src/lib/eina_unicode.c +++ b/legacy/eina/src/lib/eina_unicode.c @@ -95,7 +95,8 @@ EAPI size_t eina_unicode_strnlen(const Eina_Unicode *ustr, int n) { const Eina_Unicode *end; - for (end = ustr; *end; end++) + const Eina_Unicode *last = ustr + n; /* technically not portable ;-) */ + for (end = ustr; *end && last < end; end++) ; return end - ustr; }