diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
commit | 98e0ffaefb0f241cda3a72395d3be04192ae0d47 (patch) | |
tree | 55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/locate | |
parent | b17ff922d4072ae132ece458f5b5d74a236880ac (diff) | |
parent | e81032ad243db32b8fd615b2d55ee94b9f6a5b6a (diff) | |
download | src-98e0ffaefb0f241cda3a72395d3be04192ae0d47.tar.gz src-98e0ffaefb0f241cda3a72395d3be04192ae0d47.zip |
Merge sync of head
Notes
Notes:
svn path=/projects/bmake/; revision=283595
Diffstat (limited to 'usr.bin/locate')
-rw-r--r-- | usr.bin/locate/locate/util.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c index a28690ab5183..3ac69b5d46a9 100644 --- a/usr.bin/locate/locate/util.c +++ b/usr.bin/locate/locate/util.c @@ -235,7 +235,7 @@ getwm(p) char buf[INTSIZE]; int i; } u; - register int i; + register int i, hi; for (i = 0; i < (int)INTSIZE; i++) u.buf[i] = *p++; @@ -243,10 +243,11 @@ getwm(p) i = u.i; if (i > MAXPATHLEN || i < -(MAXPATHLEN)) { - i = ntohl(i); - if (i > MAXPATHLEN || i < -(MAXPATHLEN)) + hi = ntohl(i); + if (hi > MAXPATHLEN || hi < -(MAXPATHLEN)) errx(1, "integer out of +-MAXPATHLEN (%d): %u", - MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i)); + MAXPATHLEN, abs(i) < abs(hi) ? i : hi); + return(hi); } return(i); } @@ -263,16 +264,16 @@ int getwf(fp) FILE *fp; { - register int word; + register int word, hword; word = getw(fp); if (word > MAXPATHLEN || word < -(MAXPATHLEN)) { - word = ntohl(word); - if (word > MAXPATHLEN || word < -(MAXPATHLEN)) + hword = ntohl(word); + if (hword > MAXPATHLEN || hword < -(MAXPATHLEN)) errx(1, "integer out of +-MAXPATHLEN (%d): %u", - MAXPATHLEN, abs(word) < abs(htonl(word)) ? word : - htonl(word)); + MAXPATHLEN, abs(word) < abs(hword) ? word : hword); + return(hword); } return(word); } |