mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08: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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user