busybox/coreutils
Ron Yorston 513a2457b6 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>
2017-07-18 16:00:38 +02:00
..
libcoreutils libbb: more compact API for bb_parse_mode() 2015-10-07 17:55:33 +02:00
basename.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
cat.c cat: fix "cat -An" ignoring -n; make numbering go througn all files 2017-07-14 10:47:18 +02:00
chgrp.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
chmod.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
chown.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
chroot.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
cksum.c shred: new applet 2017-04-07 20:45:08 +02:00
comm.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
Config.src Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
cp.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
cut.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
date.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
dd.c dd: fix status=none. Closes 10066 2017-07-14 13:44:30 +02:00
df.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
dirname.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
dos2unix.c Spelling fixes in comments, documentation, tests and examples 2017-04-17 16:13:32 +02:00
du.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
echo.c shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_foo 2017-01-10 15:13:30 +01:00
env.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
expand.c *: add comment about APPLET_ODDNAME format 2017-01-29 14:57:33 +01:00
expr.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
factor.c factor: fix stray semicolon 2017-04-17 15:57:07 +02:00
false.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
fold.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
fsync.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
head.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
hostid.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
id_test.sh
id.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
install.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
Kbuild.src shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_foo 2017-01-10 15:13:30 +01:00
link.c link: new applet 2017-01-26 00:27:53 +01:00
ln.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
logname.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
ls.c ls: fix support for long options when FEATURE_LS_COLOR is deselected 2017-05-26 16:50:53 +02:00
md5_sha1_sum.c tls: add 2nd cipher_id, TLS_RSA_WITH_AES_128_CBC_SHA, so far it doesn't work 2017-01-24 16:00:54 +01:00
mkdir.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
mkfifo.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
mknod.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
mktemp.c Sort more misplaced applets into coreutils or util-linux 2017-04-12 14:16:29 +02:00
mv.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
nice.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
nl.c cat: fix "cat -An" ignoring -n; make numbering go througn all files 2017-07-14 10:47:18 +02:00
nohup.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
nproc.c nproc: new applet 2017-04-07 21:47:53 +02:00
od_bloaty.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
od.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
paste.c whitespace fix 2017-03-24 15:00:12 +01:00
printenv.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
printf.c printf: fix format string sanity check 2017-07-18 16:00:38 +02:00
pwd.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
readlink.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
realpath.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
rm.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
rmdir.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
seq.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
shred.c shred: smaller code 2017-04-07 21:10:00 +02:00
shuf.c shuf: fix random line selection. Closes 9971 2017-07-09 00:39:15 +02:00
sleep.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
sort.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
split.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
stat.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
stty.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
sum.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
sync.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
tac.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
tail.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
tee.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
test_ptr_hack.c *: make GNU licensing statement forms more regular 2010-08-16 20:14:46 +02:00
test.c libbb: new function bb_getgroups() - allocating wrapper around getgroups() 2017-07-04 18:56:45 +02:00
timeout.c Sort some miscutils/ applets into coreutils or util-linux 2017-04-12 13:58:40 +02:00
touch.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
tr.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
true.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
truncate.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
tty.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
uname.c arch: new applet (same as unmae -m). ~30 bytes. 2017-07-16 16:43:41 +02:00
uniq.c Add help text for 'uniq -i' 2017-04-05 18:51:27 +02:00
unlink.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
usleep.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
uudecode.c uuencode: allow space instead of "`" as padding char. Closes 10046 2017-07-14 17:24:59 +02:00
uuencode.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
wc.c Big cleanup in config help and description 2017-01-10 14:58:54 +01:00
who.c fix errors found with make_single_applets.sh 2017-04-12 15:48:19 +02:00
whoami.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00
yes.c Convert all coreutils/* applets to "new style" applet definitions 2016-11-23 14:46:56 +01:00