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/uncomp.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/uncomp.c')
-rw-r--r-- | tools/lz/uncomp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/lz/uncomp.c b/tools/lz/uncomp.c index 3544cd93b..b22fc75f6 100644 --- a/tools/lz/uncomp.c +++ b/tools/lz/uncomp.c @@ -49,7 +49,7 @@ struct command * get_commands_from_file (const unsigned char * data, unsigned sh } if (slack) *slack = *size - (rp - data); *size = current - result; - return realloc(result, *size * sizeof(struct command)); + return realloc(result, (*size ? *size : 1) * sizeof(struct command)); error: free(result); return NULL; @@ -88,5 +88,5 @@ unsigned char * get_uncompressed_data (const struct command * commands, const un } } *size = current - result; - return result; + return realloc(result, *size ? *size : 1); } |