diff options
author | Maciej W. Rozycki <macro@redhat.com> | 2025-08-23 01:02:10 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@redhat.com> | 2025-08-23 01:02:46 +0100 |
commit | 2b16c76609350ec887d49afd4447743da38f7fab (patch) | |
tree | a413d20a3d4875e0591fd6cda880353698ba3548 /sysdeps/unix/bsd | |
parent | e377a7a8ecb7d829a62789286b9f6aff6e17ded7 (diff) | |
download | glibc-2b16c76609350ec887d49afd4447743da38f7fab.zip glibc-2b16c76609350ec887d49afd4447743da38f7fab.tar.gz glibc-2b16c76609350ec887d49afd4447743da38f7fab.tar.bz2 |
stdio-common: Reject insufficient character data in scanf [BZ #12701]
Reject invalid formatted scanf character data with the 'c' conversion
where there is not enough input available to satisfy the field width
requested. It is required by ISO C that this conversion matches a
sequence of characters of exactly the number specified by the field
width and it is also already documented as such in our own manual:
"It reads precisely the next N characters, and fails if it cannot get
that many."
Currently a matching success is instead incorrectly produced where the
EOF condition is encountered before the required number of characters
has been retrieved, and the characters actually obtained are stored in
the buffer provided.
Add test cases accordingly and remove placeholders from 'c' conversion
input data for the existing scanf tests.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix/bsd')
0 files changed, 0 insertions, 0 deletions