mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-25 11:19:59 +01:00
filesystem: fix buffer overflow in FS_Read when we pass single byte buffer to it with one character sitting in ungetc
This commit is contained in:
parent
f4a77308ec
commit
3917c2589d
@ -2137,6 +2137,10 @@ fs_offset_t FS_Read( file_t *file, void *buffer, size_t buffersize )
|
||||
buffersize--;
|
||||
file->ungetc = EOF;
|
||||
done = 1;
|
||||
|
||||
// we had one byte in the buffer, it was ungetc'ed, so exit
|
||||
if( buffersize == 0 )
|
||||
return 1;
|
||||
}
|
||||
else done = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user