diff options
author | IIMarckus <iimarckus@gmail.com> | 2020-06-28 23:29:04 -0600 |
---|---|---|
committer | IIMarckus <iimarckus@gmail.com> | 2020-06-28 23:29:04 -0600 |
commit | 9dbe676f445210aaaa6eedcd805cbb65318ac77f (patch) | |
tree | 26c817df24e358e67cf05e1833ffb7a409173515 /tools/lz/mpcomp.c | |
parent | 152efaadc014b3095e087a5375c76be1fb1a9da0 (diff) | |
parent | c1fc2368c605e7db7d23de43e74d6e8040f94dd7 (diff) |
Merge branch 'master' of https://github.com/aaaaaa123456789/pokegold
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 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; |