newlib: vfwscanf: fix miscomputation of max field width in %[] case

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2017-11-30 21:02:38 +01:00
parent b9a662bb4c
commit 7161622514
1 changed files with 1 additions and 1 deletions

View File

@ -879,7 +879,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
n = 0; n = 0;
memset ((_PTR) &mbs, '\0', sizeof (mbstate_t)); memset ((_PTR) &mbs, '\0', sizeof (mbstate_t));
while ((wi = _fgetwc_r (rptr, fp)) != WEOF while ((wi = _fgetwc_r (rptr, fp)) != WEOF
&& width-- != 0 && INCCL (wi)) && width != 0 && INCCL (wi))
{ {
if (width >= MB_CUR_MAX && !(flags & SUPPRESS)) if (width >= MB_CUR_MAX && !(flags & SUPPRESS))
{ {