Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Apr 2009 21:23:04 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190656 - head/usr.bin/locate/locate
Message-ID:  <200904022123.n32LN4hp076380@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904022123.n32LN4hp076380>