user32: Fix wsprintfA's buffer usage when using %S.
This fixes a regression introduced by
08bf605acb
.
It could lead to stack corruption because ret can be negative when the
output position, p, doesn't point the beginning of the buffer before
the inner loop.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
31800a1414
commit
8baf70a2d0
|
@ -413,8 +413,8 @@ static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, __ms_va_list arg
|
|||
{
|
||||
CHAR mb[5]; /* 5 is MB_LEN_MAX */
|
||||
int ret = WideCharToMultiByte( CP_ACP, 0, ptr, 1, mb, sizeof(mb), NULL, NULL );
|
||||
if (ret > len - i) ret = len - i;
|
||||
i += ret;
|
||||
if (i > len) ret = len - (p - buffer);
|
||||
memcpy( p, mb, ret );
|
||||
p += ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue