From 267352c4d8d4d390fc41e9db7e35f501d059eed3 Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Sun, 28 Jun 2020 05:20:05 -0300 Subject: Update lzcomp --- tools/lz/mpcomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/lz/mpcomp.c') diff --git a/tools/lz/mpcomp.c b/tools/lz/mpcomp.c index 5961be8eb..c8829852c 100644 --- a/tools/lz/mpcomp.c +++ b/tools/lz/mpcomp.c @@ -101,7 +101,7 @@ struct command pick_copy_for_pass (const unsigned char * data, const unsigned ch current = buffer + refpos - (length - 3); else current = reference + refpos; - if (memcmp(data + position, current, 4)) continue; + if (memcmp(data + position, current, ((position + 4) > length) ? length - position : 4)) continue; for (count = 4; (count < (length - position)) && (count < (length - refpos)); count ++) if (data[position + count] != current[count]) break; if (count > (length - refpos)) count = length - refpos; if (count > (length - position)) count = length - position; -- cgit v1.2.3