[Fix] Slight change to pack file to append '\0' to string.
This commit is contained in:
parent
7e013e5b91
commit
d57bcd0484
@ -252,9 +252,9 @@ void* pack_readfile(const char* packfile, const char* filename, uint32_t* filesi
|
||||
}
|
||||
DEBUG("Opened file '%s' from '%s'", filename, packfile);
|
||||
|
||||
// Read the entire thing.
|
||||
// Read the entire file.
|
||||
size = file->end - file->start;
|
||||
buf = malloc(size);
|
||||
buf = malloc(size+1);
|
||||
if((bytes = pack_read(file, buf, size)) != size) {
|
||||
ERR("Reading '%s' from packfile '%s'. Expected %d bytes got %d bytes", filename, packfile, size, bytes);
|
||||
free(buf);
|
||||
@ -262,6 +262,7 @@ void* pack_readfile(const char* packfile, const char* filename, uint32_t* filesi
|
||||
return NULL;
|
||||
}
|
||||
DEBUG("Read %d bytes from '%s'", bytes, filename);
|
||||
memset(buf+size, '\0', 1); // Append size '\0' for it to validate as a string.
|
||||
|
||||
// Check the md5.
|
||||
md5_state_t md5;
|
||||
|
Loading…
Reference in New Issue
Block a user