Package: bsdmainutils
Version: 9.0.11
Severity: normal
Tags: lfs upstream

Dear Maintainer,

hexdump chokes when given a length argument over 2^31-1, e.g.:
  hexdump -n 4000000000
with the following message:
  hexdump: 4000000000: bad length value

This is not an uncommon value to use when dealing with physical devices, e.g.
USB sticks, and shouldn't be a problem on a 64bit system (hexdump itself is
indeed a 64bit binary).
Do note however that argument `-s' does not exhibit this behavior, so it is
possible to hexdump a whole USB stick in increments of 2^31-1 bytes.

I ran it through GDB and it occurs that hexdump is using atoi() to parse the
length argument, hence the limitation to 2^31-1, while it uses strtoll() to
parse the skip argument (hence the absence of limitation even on a 32bit
system).
I've also been looking at the source for hexdump from util-linux (not the same
upstream as Debian's hexdump, which comes from bsdmainutils), and it appears
they have been using 64bit-wide datatypes (as far as Unix is concerned) for the
length argument since as far back as 2011.

So I'm wondering, is there anything preventing Debian to switch over to
util-linux's hexdump?
I haven't checked what most other distros do, but at least Gentoo Linux's
hexdump comes from util-linux.

If that's not an option, then bsdmainutils' hexdump should be fixed.

Cheers,
Quentin


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.6.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages bsdmainutils depends on:
ii  bsdutils     1:2.28.2-1
ii  debianutils  4.8
ii  libbsd0      0.8.3-1
ii  libc6        2.24-4
ii  libncurses5  6.0+20160917-1
ii  libtinfo5    6.0+20160917-1

bsdmainutils recommends no packages.

Versions of packages bsdmainutils suggests:
ii  cpp                   4:6.1.1-1
pn  vacation              <none>
ii  wamerican [wordlist]  7.1-1
ii  whois                 5.2.12

-- no debconf information

Reply via email to