diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2024-10-08 04:23:29 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-10-08 04:23:29 +0200 |
commit | 75ca8d074bacb6896d770993b93161c40aa31b9f (patch) | |
tree | 445623d8f69c93479563c1933a96fd387a85cfa8 /util-linux | |
parent | 49d9e06fbab0b02a71deed57610edb0c8f4fb20c (diff) | |
download | busybox-w32-75ca8d074bacb6896d770993b93161c40aa31b9f.tar.gz busybox-w32-75ca8d074bacb6896d770993b93161c40aa31b9f.tar.bz2 busybox-w32-75ca8d074bacb6896d770993b93161c40aa31b9f.zip |
hexdump: accept hex numbers in -n, closes 16195
function old new delta
hexdump_main 366 383 +17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/hexdump.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index c46ffeca7..5a938e783 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c | |||
@@ -127,15 +127,20 @@ int hexdump_main(int argc, char **argv) | |||
127 | if (ch == 'f') { | 127 | if (ch == 'f') { |
128 | bb_dump_addfile(dumper, optarg); | 128 | bb_dump_addfile(dumper, optarg); |
129 | } /* else */ | 129 | } /* else */ |
130 | if (ch == 'n') { | 130 | if (ch == 'n') { /* compat: -n accepts hex numbers too */ |
131 | dumper->dump_length = xatoi_positive(optarg); | 131 | dumper->dump_length = xstrtou_range_sfx( |
132 | optarg, | ||
133 | /*base:*/ 0, | ||
134 | /*lo:*/ 0, /*hi:*/ INT_MAX, | ||
135 | kmg_i_suffixes | ||
136 | ); | ||
132 | } /* else */ | 137 | } /* else */ |
133 | if (ch == 's') { /* compat: -s accepts hex numbers too */ | 138 | if (ch == 's') { /* compat: -s accepts hex numbers too */ |
134 | dumper->dump_skip = xstrtoull_range_sfx( | 139 | dumper->dump_skip = xstrtoull_range_sfx( |
135 | optarg, | 140 | optarg, |
136 | /*base:*/ 0, | 141 | /*base:*/ 0, |
137 | /*lo:*/ 0, /*hi:*/ OFF_T_MAX, | 142 | /*lo:*/ 0, /*hi:*/ OFF_T_MAX, |
138 | bkm_suffixes | 143 | kmg_i_suffixes |
139 | ); | 144 | ); |
140 | } /* else */ | 145 | } /* else */ |
141 | if (ch == 'v') { | 146 | if (ch == 'v') { |