diff --git a/releasenotes.md b/releasenotes.md index 9fccf1088..23ac000db 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -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. diff --git a/src/utils/unzipper.c b/src/utils/unzipper.c index 5f6b62f93..536b88112 100644 --- a/src/utils/unzipper.c +++ b/src/utils/unzipper.c @@ -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