diff options
author | Ron Yorston <rmy@pobox.com> | 2017-07-18 09:33:22 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-18 16:00:38 +0200 |
commit | 513a2457b65894b10b9fd6aa8753fca59eced08c (patch) | |
tree | 0276a3c9b9f7752133c8a6d2f5bc18fafbaee5a6 /testsuite/grep.tests | |
parent | cf5110978ba25002ec5cb46aaae2472eb66001ac (diff) | |
download | busybox-513a2457b65894b10b9fd6aa8753fca59eced08c.tar.gz |
printf: fix format string sanity check
One of the tests for printf checks for an invalid bare '%' in the
format string:
$ busybox printf '%' a b c
printf: %: invalid format
On x86_64 a slightly different test doesn't work correctly:
$ busybox printf '%' d e f
printf: invalid number 'd'
printf: invalid number 'e'
printf: invalid number 'f'
On other platforms the test fails randomly depending on how the
arguments are laid out in memory.
There are two places in the code where strchr is used to determine if
a character in the format string is valid. However, strchr also returns
a valid pointer if the character being searched for is the null terminator
thus causing the code to incorrectly suppose that a valid character has
been found.
Add explicit checks for the null terminator.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/grep.tests')
0 files changed, 0 insertions, 0 deletions