1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 11:16:16 +02:00

dd: fix parsing of numbers with more than two multipliers

* src/dd.c (parse_integer): Use recursion to support more than two
multipliers.  Also protect suffix[-1] access to ensure we don't
inspect before the passed string.
* tests/dd/bytes.sh: Add test cases.
* doc/coreutils.texi (dd invocation): Note the support for specifying
many multipliers in a number.
* NEWS: Mention the bug fix.
Fixes https://bugs.debian.org/1037275
This commit is contained in:
Pádraig Brady
2023-06-10 14:18:00 +01:00
parent b841f111de
commit e8e81fc44b
4 changed files with 21 additions and 5 deletions

View File

@@ -9818,7 +9818,7 @@ can be followed by a multiplier: @samp{b}=512, @samp{c}=1,
standard block size suffixes like @samp{k}=1024 (@pxref{Block size}).
These multipliers are GNU extensions to POSIX, except that
POSIX allows @var{bytes} to be followed by @samp{k}, @samp{b}, and
@samp{x@var{m}}.
@samp{x@var{m}}. Note @samp{x@var{m}} can be used more than once in a number.
Block sizes (i.e., specified by @var{bytes} strings) must be nonzero.
Any block size you specify via @samp{bs=}, @samp{ibs=}, @samp{obs=}, @samp{cbs=}