Commit 62a1410a authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Fix source/destination confusion in vsscanf.

parent 0bdd879f
...@@ -1178,19 +1178,19 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap) ...@@ -1178,19 +1178,19 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap)
else goto widecharacter; else goto widecharacter;
character: character:
{ /* read single character into char */ { /* read single character into char */
char *str = suppress ? NULL : va_arg( ap, char * ); char *sptr = suppress ? NULL : va_arg( ap, char * );
char *pstr = str; char *sptr_beg = sptr;
unsigned size = UINT_MAX; unsigned size = UINT_MAX;
if (width == -1) width = 1; if (width == -1) width = 1;
while (width && nch != '\0') while (width && nch != '\0')
{ {
if (!suppress) if (!suppress)
{ {
*str++ = nch; *sptr++ = nch;
if(size) size--; if(size) size--;
else else
{ {
*pstr = 0; *sptr_beg = 0;
return rd; return rd;
} }
} }
...@@ -1202,19 +1202,19 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap) ...@@ -1202,19 +1202,19 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap)
break; break;
widecharacter: widecharacter:
{ /* read single character into a WCHAR */ { /* read single character into a WCHAR */
WCHAR *str = suppress ? NULL : va_arg( ap, WCHAR * ); WCHAR *sptr = suppress ? NULL : va_arg( ap, WCHAR * );
WCHAR *pstr = str; WCHAR *sptr_beg = sptr;
unsigned size = UINT_MAX; unsigned size = UINT_MAX;
if (width == -1) width = 1; if (width == -1) width = 1;
while (width && nch != '\0') while (width && nch != '\0')
{ {
if (!suppress) if (!suppress)
{ {
*str++ = nch; *sptr++ = nch;
if (size) size--; if (size) size--;
else else
{ {
*pstr = 0; *sptr_beg = 0;
return rd; return rd;
} }
} }
...@@ -1248,10 +1248,10 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap) ...@@ -1248,10 +1248,10 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap)
break; break;
case '[': case '[':
{ {
char *str = suppress ? NULL : va_arg( ap, char * ); char *sptr = suppress ? NULL : va_arg( ap, char * );
char *sptr = str; char *sptr_beg = sptr;
RTL_BITMAP bitMask; RTL_BITMAP bitMask;
ULONG Mask[8]; ULONG Mask[8] = { 0 };
BOOLEAN invert = FALSE; /* Set if we are NOT to find the chars */ BOOLEAN invert = FALSE; /* Set if we are NOT to find the chars */
unsigned size = UINT_MAX; unsigned size = UINT_MAX;
...@@ -1312,7 +1312,7 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap) ...@@ -1312,7 +1312,7 @@ static int NTDLL_vsscanf( const char *str, const char *format, __ms_va_list ap)
if(size > 1) size--; if(size > 1) size--;
else else
{ {
*str = 0; if (!suppress) *sptr_beg = 0;
return rd; return rd;
} }
} }
......
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