diff options
author | Nikias Bassen | 2012-02-02 02:46:58 +0100 |
---|---|---|
committer | Nikias Bassen | 2012-02-02 02:46:58 +0100 |
commit | 7375f8552d78ed501800fe0cbcfe2b03d069ad8b (patch) | |
tree | b372878f946e42d410c3b431162cef7cc852d13d /src | |
parent | 218fd38b273bd147cf38d79cf7b70da537225be0 (diff) | |
download | idevicerestore-7375f8552d78ed501800fe0cbcfe2b03d069ad8b.tar.gz idevicerestore-7375f8552d78ed501800fe0cbcfe2b03d069ad8b.tar.bz2 |
ipsw: add 0-termination to buffer returned by ipsw_extract_to_memory
Diffstat (limited to 'src')
-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); |