summaryrefslogtreecommitdiff
path: root/tools/lz/mpcomp.c
diff options
context:
space:
mode:
authoraaaaaa123456789 <aaaaaa123456789@acidch.at>2020-06-28 05:25:59 -0300
committeraaaaaa123456789 <aaaaaa123456789@acidch.at>2020-06-28 05:25:59 -0300
commitce8d8840f1d8ee301380f7a81a4d78c0485df901 (patch)
tree5503384056e9c4377b294671187bc9a7b8f70616 /tools/lz/mpcomp.c
parent3aba8710fa7740415fd2c37803e9358f6c9d820f (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 5961be8e..c8829852 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;