From 01403c8445145a1a3245e36ac7db5a560da625fb Mon Sep 17 00:00:00 2001 From: delphij Date: Thu, 2 Apr 2009 21:23:04 +0000 Subject: Don't crash when we have an invalid count number. PR: bin/32686 Submitted by: Jaakko Heinonen MFC after: 1 week --- usr.bin/locate/locate/fastfind.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'usr.bin/locate') 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; -- cgit v1.1