1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix fread/fwrite zero division when size is zero.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-11-21 01:08:36 +01:00
parent 0100b61855
commit b8f12a6856
2 changed files with 4 additions and 0 deletions

View file

@ -40,6 +40,8 @@ size_t fread_unlocked(void* ptr,
unsigned char* buf = (unsigned char*) ptr;
size_t count = element_size * num_elements;
if ( count == 0 )
return num_elements;
if ( fp->buffer_mode == _IONBF )
{

View file

@ -40,6 +40,8 @@ size_t fwrite_unlocked(const void* ptr,
const unsigned char* buf = (const unsigned char*) ptr;
size_t count = element_size * num_elements;
if ( count == 0 )
return num_elements;
if ( fp->buffer_mode == _IONBF )
{