diff -r d746888af4e5 -r db4c6b94939b src/string.c --- a/src/string.c Sun Dec 29 16:04:34 2019 +0100 +++ b/src/string.c Sun Dec 29 19:45:00 2019 +0100 @@ -682,7 +682,7 @@ sstr_t scstrreplacen_a(UcxAllocator *allocator, scstr_t str, scstr_t pattern, scstr_t replacement, size_t replmax) { - if (pattern.length == 0 || pattern.length > str.length) + if (pattern.length == 0 || pattern.length > str.length || replmax == 0) return sstrdup(str); /* Compute expected buffer length */