diff options
author | Ron Yorston <rmy@pobox.com> | 2024-10-28 07:57:29 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-10-28 07:57:29 +0000 |
commit | e697a94a2d19c1e74dc2efb168f4c40aeb30e446 (patch) | |
tree | 4af4f5b10b1bc047974e4a62fe9d314d17207db4 /libbb | |
parent | a9cf4418d930ba38e3a9e000342fb7fcbd26e8ca (diff) | |
download | busybox-w32-e697a94a2d19c1e74dc2efb168f4c40aeb30e446.tar.gz busybox-w32-e697a94a2d19c1e74dc2efb168f4c40aeb30e446.tar.bz2 busybox-w32-e697a94a2d19c1e74dc2efb168f4c40aeb30e446.zip |
cut: improve detection of invalid ranges
Commit 0068ce2fa (cut: add toybox-compatible options -O OUTSEP,
-D, -F LIST) added detection of reversed ranges. Further
improvements are possible.
- The test for reversed ranges compared the start after it had been
decremented with the end before decrement. It thus missed ranges
of the form 2-1.
- Zero isn't a valid start value for a range. (Nor is it a valid
end value, but that's caught by the test for a reversed range.)
- The code
if (!*ltok)
e = INT_MAX;
duplicates a check that's already been made.
- Display the actual range in the error message to make it easier
to find which range was at fault.
Adds 0-48 bytes.
(GitHub issue #467)
Diffstat (limited to 'libbb')
0 files changed, 0 insertions, 0 deletions