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
1 changed files with 4 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue