nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit ceaae49b2d7b935f849f065c4ec2e9d3537c9e1b
parent d1957819c484c77a3bad030b9b182fa8bd95d14a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 23 May 2021 11:46:37 +0200

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.

Diffstat:
Msrc/chars.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chars.c b/src/chars.c @@ -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;