summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2009-04-02 21:23:04 +0000
committerdelphij <delphij@FreeBSD.org>2009-04-02 21:23:04 +0000
commit01403c8445145a1a3245e36ac7db5a560da625fb (patch)
tree2a02b1cca0f2568fcbd833ebc7097ab09bbd116a /usr.bin
parent77d3ac29e92a3eee07ea5b553bddc85cdf1fdae4 (diff)
downloadFreeBSD-src-01403c8445145a1a3245e36ac7db5a560da625fb.zip
FreeBSD-src-01403c8445145a1a3245e36ac7db5a560da625fb.tar.gz
Don't crash when we have an invalid count number.
PR: bin/32686 Submitted by: Jaakko Heinonen <jh saunalahti.fi> MFC after: 1 week
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/locate/locate/fastfind.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c
index e132dbd..d9ab2d0 100644
--- a/usr.bin/locate/locate/fastfind.c
+++ b/usr.bin/locate/locate/fastfind.c
@@ -216,6 +216,8 @@ fastfind
count += c - OFFSET;
}
+ if (count < 0 || count > MAXPATHLEN)
+ errx(1, "corrupted database: %s", database);
/* overlay old path */
p = path + count;
foundchar = p - 1;
OpenPOWER on IntegriCloud