Skip to content

Commit

Permalink
Fix bug when reading zip manifest, that would not return a zero termi…
Browse files Browse the repository at this point in the history
…nated string. #1490
  • Loading branch information
lerno committed Sep 29, 2024
1 parent a00fce5 commit 071bd0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
- Error when slicing a struct with an inline array #1488.
- Improved error messages on `Foo a = foo { 1 };` #1496
- Bug in json decoder escape handling.
- Fix bug when reading zip manifest, that would not return a zero terminated string. #1490

### Stdlib changes
- Additional init functions for hashmap.
Expand Down
3 changes: 2 additions & 1 deletion src/utils/unzipper.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ const char *zip_file_read(FILE *zip, ZipFile *file, void **buffer_ptr)
const char *error = zip_prepare_zip_for_read(zip, file);
if (error) return error;

unsigned char *bytes = MALLOC(file->uncompressed_size);
unsigned char *bytes = MALLOC(file->uncompressed_size + 1);
bytes[file->uncompressed_size] = 0;
*buffer_ptr = bytes;

// Uncompressed
Expand Down

0 comments on commit 071bd0e

Please sign in to comment.