From c360a8907b132495e411824c92dfe4189e76ac3d Mon Sep 17 00:00:00 2001 From: jbj Date: Tue, 17 Apr 2001 18:23:58 +0000 Subject: [PATCH] - fix: s390 (and ppc?) could return CPIOERR_BAD_HEADER (#28645). CVS patchset: 4682 CVS date: 2001/04/17 18:23:58 --- CHANGES | 1 + lib/cpio.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 46892c7..d8a0968 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,7 @@ - fix: --excludedoc shouldn't create empty doc dir (#14531). - fix: %_netsharedpath needs to look at basenames (#26561). - fix: --excludepath was broken (#24434). + - fix: s390 (and ppc?) could return CPIOERR_BAD_HEADER (#28645). 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. diff --git a/lib/cpio.c b/lib/cpio.c index f633e66..fa5c8b1 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -50,14 +50,14 @@ static int strntoul(const char *str, /*@out@*/char **endptr, int base, int num) if (*end) *endptr = ((char *)str) + (end - buf); /* XXX discards const */ else - *endptr = ((char *)str) + strlen(str); + *endptr = ((char *)str) + strlen(buf); return ret; } #define GET_NUM_FIELD(phys, log) \ log = strntoul(phys, &end, 16, sizeof(phys)); \ - if (*end) return CPIOERR_BAD_HEADER; + if ( (end - phys) != sizeof(phys) ) return CPIOERR_BAD_HEADER; #define SET_NUM_FIELD(phys, val, space) \ sprintf(space, "%8.8lx", (unsigned long) (val)); \ memcpy(phys, space, 8); -- 2.7.4