mirror of
https://github.com/simtactics/niotso.git
synced 2025-03-15 08:11:22 +00:00
Fixed Pascal string reading in GLOB chunks
This commit is contained in:
parent
62ad3dfc4f
commit
78f1ca1d6f
1 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue