Skip to content

Commit 2e32720

Browse files
author
Paul Gofman
committed
shlwapi: Output unrecognized format symbol in wvnsprintf().
CW-Bug-Id: #24355
1 parent cd40157 commit 2e32720

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

dlls/shlwapi/tests/string.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,9 @@ static void test_printf_format(void)
17751775
{ "%I64llu", sizeof(ULONG64), "10", NULL, 10 },
17761776
{ "%I64s", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)"str", L"str" },
17771777
{ "%q%u", sizeof(ULONG), "q10", NULL, 10 },
1778+
{ "%lhw%u", 0, "%u", NULL, 10 },
17781779
{ "%u% ", sizeof(ULONG), "10", NULL, 10 },
1780+
{ "%u% %u", sizeof(ULONG), "10%u", NULL, 10 },
17791781
{ "% ll u", 0, " u", NULL, 10 },
17801782
{ "% llu", sizeof(ULONG64), "10", NULL, 10 },
17811783
{ "%# llx", sizeof(ULONG64), "0xa", NULL, 10 },

dlls/shlwapi/wsprintf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ INT WINAPI wvnsprintfA( LPSTR buffer, INT maxlen, LPCSTR spec, va_list args )
483483
p += len - sign;
484484
break;
485485
case WPR_UNKNOWN:
486+
if (*spec) *p++ = *spec++;
486487
continue;
487488
}
488489
if (format.flags & WPRINTF_LEFTALIGN)
@@ -603,6 +604,7 @@ INT WINAPI wvnsprintfW( LPWSTR buffer, INT maxlen, LPCWSTR spec, va_list args )
603604
for (i = sign; i < len; i++) *p++ = (BYTE)number[i];
604605
break;
605606
case WPR_UNKNOWN:
607+
if (*spec) *p++ = *spec++;
606608
continue;
607609
}
608610
if (format.flags & WPRINTF_LEFTALIGN)

0 commit comments

Comments
 (0)