diff options
author | Ron Yorston | 2017-07-19 10:43:10 +0100 |
---|---|---|
committer | Denys Vlasenko | 2017-07-19 13:12:02 +0200 |
commit | a165603d24dc3b5080859abfa834d092f456489d (patch) | |
tree | cc418520ca4343d57cb99678187e76e991885c0e /coreutils/whoami.c | |
parent | 9880f86d6e68a2a9b0d691ad0667f38d73eb89e0 (diff) | |
download | busybox-a165603d24dc3b5080859abfa834d092f456489d.zip busybox-a165603d24dc3b5080859abfa834d092f456489d.tar.gz |
od_bloaty: fix floating point output
Currently od_bloaty does this:
$ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -f
od: invalid character 'F' in type string 'fF'
$ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -t fD
od: invalid character 'D' in type string 'fD'
$ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -t f
0000000
0000010
The first two occur because the alphabetic length specifier isn't being
properly skipped. The third is due to the empty length specifier being
treated as alphabetic so we fall off the end of the FDL_sizeof array with
undetermined consequences. Coreutils defaults to printing a double in
this case.
With this patch the output is:
$ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -f
0000000 0.0000000e+00 0.0000000e+00
0000010
$ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -t fD
0000000 0.000000000000000e+00
0000010
$ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -t f
0000000 0.000000000000000e+00
0000010
I guess nobody uses BusyBox od to print floating point numbers.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/whoami.c')
0 files changed, 0 insertions, 0 deletions