summaryrefslogtreecommitdiff
path: root/lib/cpio.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-04-17 18:23:58 +0000
committerjbj <devnull@localhost>2001-04-17 18:23:58 +0000
commitc360a8907b132495e411824c92dfe4189e76ac3d (patch)
treef36c38ca27bf9eb759721fbff70d27ed3dcc8f91 /lib/cpio.c
parent1ea9d2cf9d4a58f2c5cf0489a326dbb495e613a0 (diff)
downloadrpm-c360a8907b132495e411824c92dfe4189e76ac3d.tar.gz
rpm-c360a8907b132495e411824c92dfe4189e76ac3d.tar.bz2
rpm-c360a8907b132495e411824c92dfe4189e76ac3d.zip
- fix: s390 (and ppc?) could return CPIOERR_BAD_HEADER (#28645).
CVS patchset: 4682 CVS date: 2001/04/17 18:23:58
Diffstat (limited to 'lib/cpio.c')
-rw-r--r--lib/cpio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/cpio.c b/lib/cpio.c
index f633e66ee..fa5c8b100 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);