msvcrt: Fix floating point numbers scanning when null-byte is preceding the number.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48452
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-01-13 20:17:17 +01:00 committed by Alexandre Julliard
parent 0aaaacd199
commit 287dabd9b6
2 changed files with 8 additions and 0 deletions

View File

@ -393,6 +393,8 @@ _FUNCTION_ {
/* skip initial whitespace */
while ((nch!=_EOF_) && _ISSPACE_(nch))
nch = _GETC_(file);
if (nch == _EOF_)
break;
ctx.unget = nch;
#ifdef STRING
ctx.file = file;

View File

@ -165,6 +165,12 @@ static void test_sscanf( void )
ok(double_res >= 1.1e-30-1e-45 && double_res <= 1.1e-30+1e-45,
"Got %.18le, expected %.18le\n", double_res, 1.1e-30);
buffer[0] = 0;
double_res = 1;
ret = p_sscanf(buffer, "%lf", &double_res);
ok(ret == -1, "expected 0, got %u\n", ret);
ok(double_res == 1, "Got %lf, expected 1\n", double_res);
/* check strings */
ret = p_sprintf(buffer," %s", pname);
ok( ret == 26, "expected 26, got %u\n", ret);