diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h index b2e6bd7c801..0fa1e6fc376 100644 --- a/dlls/msvcrt/scanf.h +++ b/dlls/msvcrt/scanf.h @@ -699,7 +699,7 @@ _FUNCTION_ { * a matching non-white-space character. */ else { /* check for character match */ - if (nch == *format) { + if (nch == (unsigned char)*format) { nch = _GETC_(file); } else break; } diff --git a/dlls/msvcrt/tests/scanf.c b/dlls/msvcrt/tests/scanf.c index 6cb85facaf6..ecb270baf49 100644 --- a/dlls/msvcrt/tests/scanf.c +++ b/dlls/msvcrt/tests/scanf.c @@ -251,6 +251,10 @@ static void test_sscanf( void ) ok(ret == 2, "got %d\n", ret); ok(!strcmp(buffer, "test"), "buf %s\n", buffer); 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)