summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/locate/locate/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index 38fe284..feaa32a 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -241,7 +241,8 @@ getwm(p)
if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
i = ntohl(i);
if (i > MAXPATHLEN || i < -(MAXPATHLEN))
- errx(1, "integer out of +-MAXPATHLEN (%d): %d", MAXPATHLEN, i);
+ errx(1, "integer out of +-MAXPATHLEN (%d): %d",
+ MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
}
return(i);
}
@@ -265,7 +266,9 @@ getwf(fp)
if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
word = ntohl(word);
if (word > MAXPATHLEN || word < -(MAXPATHLEN))
- errx(1, "integer out of +-MAXPATHLEN (%d): %d", MAXPATHLEN, word);
+ errx(1, "integer out of +-MAXPATHLEN (%d): %d",
+ MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
+ htonl(word));
}
return(word);
}
OpenPOWER on IntegriCloud