diff options
-rw-r--r-- | src/ipsw.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -151,7 +151,7 @@ int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, } int size = zstat.size; - char* buffer = (unsigned char*) malloc(size); + char* buffer = (unsigned char*) malloc(size+1); if (buffer == NULL) { error("ERROR: Out of memory\n"); zip_fclose(zfile); @@ -165,6 +165,8 @@ int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, return -1; } + buffer[size] = '\0'; + zip_fclose(zfile); ipsw_close(archive); |