Alexandre Julliard : ntdll:
Properly handle embedded nulls in NTDLL_dbg_vprintf.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 24 06:18:38 CST 2007
Module: wine
Branch: master
Commit: 938e6758608ebb6c18aee9eb88e244f141b64879
URL: http://source.winehq.org/git/wine.git/?a=commit;h=938e6758608ebb6c18aee9eb88e244f141b64879
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jan 24 12:46:17 2007 +0100
ntdll: Properly handle embedded nulls in NTDLL_dbg_vprintf.
---
dlls/ntdll/debugtools.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c
index 760dff4..d66124c 100644
--- a/dlls/ntdll/debugtools.c
+++ b/dlls/ntdll/debugtools.c
@@ -121,7 +121,7 @@ static const char *NTDLL_dbgstr_wn( cons
static int NTDLL_dbg_vprintf( const char *format, va_list args )
{
struct debug_info *info = get_info();
- char *p;
+ int end;
int ret = vsnprintf( info->out_pos, sizeof(info->output) - (info->out_pos - info->output),
format, args );
@@ -138,16 +138,16 @@ static int NTDLL_dbg_vprintf( const char
abort();
}
- p = strrchr( info->out_pos, '\n' );
- if (!p) info->out_pos += ret;
+ for (end = ret; end > 0; end--) if (info->out_pos[end - 1] == '\n') break;
+
+ if (!end) info->out_pos += ret;
else
{
char *pos = info->output;
- p++;
- write( 2, pos, p - pos );
+ write( 2, pos, info->out_pos + end - pos );
/* move beginning of next line to start of buffer */
- while ((*pos = *p++)) pos++;
- info->out_pos = pos;
+ memmove( pos, info->out_pos + end, ret - end );
+ info->out_pos = pos + ret - end;
}
return ret;
}
More information about the wine-cvs
mailing list