From c360a8907b132495e411824c92dfe4189e76ac3d Mon Sep 17 00:00:00 2001 From: jbj Date: Tue, 17 Apr 2001 18:23:58 +0000 Subject: - fix: s390 (and ppc?) could return CPIOERR_BAD_HEADER (#28645). CVS patchset: 4682 CVS date: 2001/04/17 18:23:58 --- lib/cpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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); -- cgit v1.2.3