Skip to content
Snippets Groups Projects
Commit 26af8221 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard
Browse files

More descriptive error on buffer overflow.

parent e79f0768
No related branches found
No related tags found
No related merge requests found
......@@ -209,9 +209,16 @@ int wine_dbg_vprintf( const char *format, va_list args )
format, args );
/* make sure we didn't exceed the buffer length
* the two asserts are due to glibc changes in vsnprintfs return value */
assert( ret != -1 );
assert( ret < sizeof(info->output) - (info->out_pos - info->output) );
* the two checks are due to glibc changes in vsnprintfs return value
* the buffer size can be exceeded in case of a missing \n in
* debug output */
if ((ret == -1) || (ret >= sizeof(info->output) - (info->out_pos - info->output)))
{
fprintf( stderr, "wine_dbg_vprintf: debugstr buffer overflow (contents: '%s')\n",
info->output);
info->out_pos = info->output;
abort();
}
p = strrchr( info->out_pos, '\n' );
if (!p) info->out_pos += ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment