ntdll: Fix source/destination confusion in vsscanf.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-01-05 16:09:30 +01:00
parent 0bdd879fde
commit 62a1410a07

View File

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