Commit b0424313 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Handle negative file->_cnt value in fwrite.

parent 755eac8f
......@@ -3691,7 +3691,11 @@ MSVCRT_size_t CDECL MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_si
MSVCRT__lock_file(file);
while(wrcnt) {
if(file->_cnt) {
if(file->_cnt < 0) {
WARN("negative file->_cnt value in %p\n", file);
file->_flag |= MSVCRT__IOERR;
break;
} else if(file->_cnt) {
int pcnt=(file->_cnt>wrcnt)? wrcnt: file->_cnt;
memcpy(file->_ptr, ptr, pcnt);
file->_cnt -= pcnt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment