summaryrefslogtreecommitdiffstats
path: root/src/ipsw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipsw.c')
-rw-r--r--src/ipsw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ipsw.c b/src/ipsw.c
index d3f8839..19cf924 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -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);