svn commit: r190656 - head/usr.bin/locate/locate

Xin LI delphij at FreeBSD.org
Thu Apr 2 14:23:05 PDT 2009


Author: delphij
Date: Thu Apr  2 21:23:04 2009
New Revision: 190656
URL: http://svn.freebsd.org/changeset/base/190656

Log:
  Don't crash when we have an invalid count number.
  
  PR:		bin/32686
  Submitted by:	Jaakko Heinonen <jh saunalahti.fi>
  MFC after:	1 week

Modified:
  head/usr.bin/locate/locate/fastfind.c

Modified: head/usr.bin/locate/locate/fastfind.c
==============================================================================
--- head/usr.bin/locate/locate/fastfind.c	Thu Apr  2 21:16:20 2009	(r190655)
+++ head/usr.bin/locate/locate/fastfind.c	Thu Apr  2 21:23:04 2009	(r190656)
@@ -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;


More information about the svn-src-head mailing list