mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
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
1 changed files with 6 additions and 2 deletions
|
|
@ -464,9 +464,11 @@ literal:
|
|||
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 @@ literal:
|
|||
*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 a new issue