Fix off-by-one error when pushing back a multibyte sequence in
wide character class (%l[) and wide string (%ls) conversions.
This commit is contained in:
parent
44f219ea75
commit
0145ba86d1
@ -464,9 +464,11 @@ again: c = *fmt++;
|
||||
if (nconv != (size_t)-2) {
|
||||
if (wctob(*wcp) != EOF &&
|
||||
!ccltab[wctob(*wcp)]) {
|
||||
while (--n > 0)
|
||||
while (n != 0) {
|
||||
n--;
|
||||
__ungetc(buf[n],
|
||||
fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
nread += n;
|
||||
@ -562,9 +564,11 @@ again: c = *fmt++;
|
||||
*wcp = L'\0';
|
||||
if (nconv != (size_t)-2) {
|
||||
if (iswspace(*wcp)) {
|
||||
while (--n > 0)
|
||||
while (n != 0) {
|
||||
n--;
|
||||
__ungetc(buf[n],
|
||||
fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
nread += n;
|
||||
|
Loading…
Reference in New Issue
Block a user