Fixed Pascal string reading in GLOB chunks

This commit is contained in:
Fatbag 2012-05-25 16:44:44 -05:00
parent 62ad3dfc4f
commit 78f1ca1d6f

View file

@ -23,12 +23,15 @@ int iff_parse_glob(IFFChunk * ChunkInfo, const uint8_t * Buffer){
unsigned Size = ChunkInfo->Size - 76;
unsigned length;
if(Size == 0) return 0;
if(Size == 0){
*string = NULL;
return 0;
}
/* Try reading as a C string */
for(length=0; length != Size && Buffer[length] && Buffer[length] != 0xA3; length++);
if(length != Size){
if(length != Size && !Buffer[length] /* null character; in these strings, 0xA3 doesn't count */){
if(length > 0){
*string = malloc(length+1);
if(*string == NULL) return 0;