]> git.ipfire.org Git - thirdparty/libarchive.git/commit
bsdtar: Fix error handling around strtol() usages (#2110)
authorTim Kientzle <kientzle@acm.org>
Thu, 25 Apr 2024 09:39:22 +0000 (02:39 -0700)
committerGitHub <noreply@github.com>
Thu, 25 Apr 2024 09:39:22 +0000 (11:39 +0200)
commitd9f44c5b44038c735a78cc1b32fda1ea7b88be25
tree9ed20d1ba7fae9c8e7b31a717a57a65fe69ed26e
parentf673faefaad28de77e91167e1a70d7c2a32af7fe
bsdtar: Fix error handling around strtol() usages (#2110)

The code here had a couple of bad code patterns that seem to have been
copied throughout:
* Checking errno after strtol() -- Standard C doesn't seem to actually
require this, so we shouldn't rely on it
* Casting the result of strtol() directly to `int`. This loses
information prematurely.

Instead, I've added `l` as a temporary of type `long`, use that to hold
the result of `strtol()` until it can be checked. I've also removed the
`errno` tests in favor of checking the end pointer value.

The limit for --strip-components has been raised to 100 000.
tar/bsdtar.c