]> sourceware.org Git - newlib-cygwin.git/commit
newlib: vf[w]scanf: Drop width computation mixup
authorCorinna Vinschen <corinna@vinschen.de>
Fri, 1 Dec 2017 12:47:26 +0000 (13:47 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 1 Dec 2017 12:47:26 +0000 (13:47 +0100)
commit9638c0752798c1c9aaf2e56ebaab240eae5eb8dc
tree38a1f1cac05a1bc5dcd2cc41f8263bac12316b5e
parent70afa0c7b31dd54fe6841d906afd3a8ae5c958cb
newlib: vf[w]scanf: Drop width computation mixup

The width value keeps the maximum field width.  This is the maximum
field width of the *input*.  It's *never* to be used in conjunction
with the number of bytes or characters written to the output argument.

However, especially in vfwscanf, the code is partially taken from
NetBSD which erroneously subtracts the number of multibyte chars
written to the argument from the width variable, thus potentially
subtracting up to MB_CUR_MAX from width for a single character in
the input stream.

To make matters worse, the previous patch adding %m added basically
the same mistake for 'c' type input.

Fix it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
newlib/libc/stdio/vfscanf.c
newlib/libc/stdio/vfwscanf.c
This page took 0.028145 seconds and 5 git commands to generate.