diff options
author | Peter Korsgaard <jacmet@sunsite.dk> | 2013-09-10 11:52:35 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-09-10 16:22:12 +0200 |
commit | 2a053a2430e8de2f5de3da7d4d25343f61161f09 (patch) | |
tree | ecf4d1bc83b7f7ec3672758d81f3eec5a346246f /procps/lsof.c | |
parent | dc57294485068e644714804ad1b1a3a10c4fceec (diff) | |
download | busybox-2a053a2430e8de2f5de3da7d4d25343f61161f09.tar.gz |
ar: read_num(): fix reading fields using the entire width
ar fields are fixed length text strings (padded with spaces). Ensure
bb_strtou doesn't read past the field in case the full width is used.
The fields are only read once, so the simplest/smallest solution to me
seems to be to just pass the length to read_num() and then zero terminate
the string before passing it to bb_strtou. This does mean that the fields
MUST be read in reverse order, so some minor reshuffling was needed.
Bloat-o-meter:
function old new delta
get_header_ar 394 414 +20
read_num 29 36 +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0) Total: 27 bytes
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps/lsof.c')
0 files changed, 0 insertions, 0 deletions