Sun, 29 Dec 2019 19:45:00 +0100
fixes string replace function in case replmax is 0
src/string.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/string.c Sun Dec 29 16:04:34 2019 +0100 1.2 +++ b/src/string.c Sun Dec 29 19:45:00 2019 +0100 1.3 @@ -682,7 +682,7 @@ 1.4 sstr_t scstrreplacen_a(UcxAllocator *allocator, scstr_t str, 1.5 scstr_t pattern, scstr_t replacement, size_t replmax) { 1.6 1.7 - if (pattern.length == 0 || pattern.length > str.length) 1.8 + if (pattern.length == 0 || pattern.length > str.length || replmax == 0) 1.9 return sstrdup(str); 1.10 1.11 /* Compute expected buffer length */