tweaks: avoid the subtraction of two size_t variables becoming negative
This fixes https://savannah.gnu.org/bugs/?60658. Found by compiling with -fsanitize=undefined.master
parent
d1957819c4
commit
ceaae49b2d
|
@ -540,7 +540,7 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||||
size_t tail_len = mbstrlen(pointer);
|
size_t tail_len = mbstrlen(pointer);
|
||||||
|
|
||||||
if (tail_len < needle_len)
|
if (tail_len < needle_len)
|
||||||
pointer += tail_len - needle_len;
|
pointer -= (needle_len - tail_len);
|
||||||
|
|
||||||
if (pointer < haystack)
|
if (pointer < haystack)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue