This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=dcd19c7820e0294245837ee9e8beec9244ea3b2d commit dcd19c7820e0294245837ee9e8beec9244ea3b2d Author: Guillem Jover <[email protected]> AuthorDate: Wed Mar 6 03:52:10 2019 +0100 libdpkg: Use ERANGE instead of EINVAL for tar_atol8() out-of-range error We should use the correct errno value, otherwise the error string makes little sense, and ends up being very confusing. --- debian/changelog | 1 + lib/dpkg/t/t-tar.c | 8 ++++---- lib/dpkg/tarfn.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 43153c343..3346afa9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ dpkg (1.19.6) UNRELEASED; urgency=medium * libdpkg: Set tar_entry to zero on tar_entry_destroy(), to avoid double free()s and the subsequent crashes. * libdpkg: Handle non end-of-tape errors from tar_header_decode(). + * libdpkg: Use ERANGE instead of EINVAL for tar_atol8() out-of-range error. * Packaging: - Update usertags. - Install a lintian profile for dpkg based on the debian profile, so that diff --git a/lib/dpkg/t/t-tar.c b/lib/dpkg/t/t-tar.c index 8417ed306..6fa217de5 100644 --- a/lib/dpkg/t/t-tar.c +++ b/lib/dpkg/t/t-tar.c @@ -72,22 +72,22 @@ test_tar_atol8(void) errno = 0; u = tar_atoul(" 11111aaa ", 12, UINTMAX_MAX); test_pass(u == 0); - test_pass(errno == EINVAL); + test_pass(errno == ERANGE); errno = 0; u = tar_atoul(" 8 ", 12, UINTMAX_MAX); test_pass(u == 0); - test_pass(errno == EINVAL); + test_pass(errno == ERANGE); errno = 0; u = tar_atoul(" 18 ", 12, UINTMAX_MAX); test_pass(u == 0); - test_pass(errno == EINVAL); + test_pass(errno == ERANGE); errno = 0; u = tar_atoul(" aa ", 12, UINTMAX_MAX); test_pass(u == 0); - test_pass(errno == EINVAL); + test_pass(errno == ERANGE); } static void diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c index 7ccdae389..a0821f217 100644 --- a/lib/dpkg/tarfn.c +++ b/lib/dpkg/tarfn.c @@ -110,7 +110,7 @@ tar_atol8(const char *s, size_t size) if (*s == '\0' || *s == ' ') break; if (*s < '0' || *s > '7') - return tar_ret_errno(EINVAL, 0); + return tar_ret_errno(ERANGE, 0); n = (n * 010) + (*s++ - '0'); } -- Dpkg.Org's dpkg

