diff options
author | tjr <tjr@FreeBSD.org> | 2002-10-17 13:04:00 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-10-17 13:04:00 +0000 |
commit | 4e85c855b377a2da707e3398be0211bdc6258395 (patch) | |
tree | 194ab0f753e999b2b5045542a5d5c537b2cd5fab /lib/libc/stdio | |
parent | 58dbe0ce7cf197ab4f377e829dcc8573602fb8af (diff) | |
download | FreeBSD-src-4e85c855b377a2da707e3398be0211bdc6258395.zip FreeBSD-src-4e85c855b377a2da707e3398be0211bdc6258395.tar.gz |
Fix off-by-one error when pushing back a multibyte sequence in
wide character class (%l[) and wide string (%ls) conversions.
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r-- | lib/libc/stdio/vfscanf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index 6aebd60..d9d3e1c 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -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; |