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

msvcrt: Don't write to buffer in ungetc if _IOSTRG flag is specified.

parent 6122c2ba
......@@ -4713,7 +4713,15 @@ int CDECL MSVCRT_ungetc(int c, MSVCRT_FILE * file)
file->_ptr++;
if(file->_ptr>file->_base) {
file->_ptr--;
*file->_ptr=c;
if(file->_flag & MSVCRT__IOSTRG) {
if(*file->_ptr != c) {
file->_ptr++;
MSVCRT__unlock_file(file);
return MSVCRT_EOF;
}
}else {
*file->_ptr = c;
}
file->_cnt++;
MSVCRT_clearerr(file);
MSVCRT__unlock_file(file);
......
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