summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2017-09-08 12:23:48 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2017-09-08 12:23:48 +0000
commitd7bcf2564fd699f188f9ed6e12fccba2317369f0 (patch)
tree4d092123c224ec9ab8c8aac463c03193b86df81b
parent0a88282164a32d18addd7b4eb505ba55f9492f92 (diff)
Avoid clang warning and make code better by using a signed long;
with hint from millert@; ok millert@ guenther@
-rw-r--r--bin/pax/tar.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/pax/tar.c b/bin/pax/tar.c
index 9b5b3668968..9508b95800a 100644
--- a/bin/pax/tar.c
+++ b/bin/pax/tar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tar.c,v 1.63 2016/08/26 04:11:16 guenther Exp $ */
+/* $OpenBSD: tar.c,v 1.64 2017/09/08 12:23:47 otto Exp $ */
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
/*-
@@ -1209,7 +1209,7 @@ static int
rd_xheader(ARCHD *arcn, int global, off_t size)
{
char buf[MAXXHDRSZ];
- unsigned long len;
+ long len;
char *delim, *keyword;
char *nextp, *p, *end;
int pad, ret = 0;
@@ -1247,8 +1247,8 @@ rd_xheader(ARCHD *arcn, int global, off_t size)
break;
}
errno = 0;
- len = strtoul(p, &delim, 10);
- if (*delim != ' ' || (errno == ERANGE && len == ULONG_MAX) ||
+ len = strtol(p, &delim, 10);
+ if (*delim != ' ' || (errno == ERANGE && len == LONG_MAX) ||
len < MINXHDRSZ) {
paxwarn(1, "Invalid extended header record length");
ret = -1;