mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-30 22:24:41 +03:00
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.
This commit is contained in:
parent
d1957819c4
commit
ceaae49b2d
@ -540,7 +540,7 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
size_t tail_len = mbstrlen(pointer);
|
||||
|
||||
if (tail_len < needle_len)
|
||||
pointer += tail_len - needle_len;
|
||||
pointer -= (needle_len - tail_len);
|
||||
|
||||
if (pointer < haystack)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user