summaryrefslogtreecommitdiff
path: root/tools/lz/mpcomp.c
diff options
context:
space:
mode:
authoraaaaaa123456789 <aaaaaa123456789@acidch.at>2020-06-28 05:20:05 -0300
committeraaaaaa123456789 <aaaaaa123456789@acidch.at>2020-06-28 05:20:05 -0300
commit267352c4d8d4d390fc41e9db7e35f501d059eed3 (patch)
tree52c3bf034afdf6a24cfe455c62554c573613abf2 /tools/lz/mpcomp.c
parent73d20afd15d625889d4cb6617833bafd0316f12b (diff)
Update lzcomp
Diffstat (limited to 'tools/lz/mpcomp.c')
-rw-r--r--tools/lz/mpcomp.c2
1 files changed, 1 insertions, 1 deletions
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;