newlib: vfwscanf: fix negation bug in %[ conversion

Old BSD bug:  While ^ is recognized and the set of matching characters
is negated, the code neglects to increment the pointer pointing to the
matching characters.  Thus, on a negation expression like %[^xyz], the
matching doesn't only stop at x, y, or z, but incorrectly also on ^.

Fix this by setting the start pointer after recognizing the ^.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2017-12-04 17:05:11 +01:00
parent 8f7c712bb8
commit 67e628fa33
1 changed files with 1 additions and 1 deletions

View File

@ -783,7 +783,6 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
break;
case L'[':
ccls = fmt;
if (*fmt == '^')
{
cclcompl = 1;
@ -791,6 +790,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
}
else
cclcompl = 0;
ccls = fmt;
if (*fmt == ']')
fmt++;
while (*fmt != '\0' && *fmt != ']')