diff options
author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2020-06-28 04:26:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 04:26:51 -0400 |
commit | a0e8e5ac5b7d91451ce6eac4c7c65641f7e5a59c (patch) | |
tree | 710ead352c491bc5125e97f1bb3f06eb6ee650c3 /tools/lz/mpcomp.c | |
parent | 73d20afd15d625889d4cb6617833bafd0316f12b (diff) | |
parent | 5e99f9390a304cab6a69fdb92467645e5be1a985 (diff) |
Merge pull request #737 from aaaaaa123456789/master
Fix an uninitialized read bug in lzcomp
Diffstat (limited to 'tools/lz/mpcomp.c')
-rw-r--r-- | tools/lz/mpcomp.c | 2 |
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; |