msvcrt: Fix handling of unsigned chars in scanf format.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-03-31 15:02:48 +02:00 committed by Alexandre Julliard
parent a8389a2b58
commit 32bb8d9068
2 changed files with 5 additions and 1 deletions

View File

@ -699,7 +699,7 @@ _FUNCTION_ {
* a matching non-white-space character. */ * a matching non-white-space character. */
else { else {
/* check for character match */ /* check for character match */
if (nch == *format) { if (nch == (unsigned char)*format) {
nch = _GETC_(file); nch = _GETC_(file);
} else break; } else break;
} }

View File

@ -251,6 +251,10 @@ static void test_sscanf( void )
ok(ret == 2, "got %d\n", ret); ok(ret == 2, "got %d\n", ret);
ok(!strcmp(buffer, "test"), "buf %s\n", buffer); ok(!strcmp(buffer, "test"), "buf %s\n", buffer);
ok(!strcmp(buffer1, "value\xda"), "buf %s\n", buffer1); ok(!strcmp(buffer1, "value\xda"), "buf %s\n", buffer1);
ret = sscanf("\x81test", "\x81%s", buffer);
ok(ret == 1, "got %d\n", ret);
ok(!strcmp(buffer, "test"), "buf = %s\n", buffer);
} }
static void test_sscanf_s(void) static void test_sscanf_s(void)