From 5474abc2d17d0a57a8295a0dad17cf1cbce05ab8 Mon Sep 17 00:00:00 2001 From: James Youngman Date: Mon, 3 May 2004 10:08:59 +0000 Subject: [PATCH] Fixes Savannah bug #8623 (failure to check consistency of data read from locate database) --- locate/locate.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/locate/locate.c b/locate/locate.c index a01e73bc..75b81aba 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -374,6 +374,15 @@ locate (pathpart, dbfile, ignore_case) else count += c; + if (count > strlen(path)) + { + /* This should not happen generally , but since we're + * reading in data which is outside our control, we + * cannot prevent it. + */ + error(1, 0, _("locate database `%s' is corrupt or invalid"), dbfile); + } + /* Overlay the old path with the remainder of the new. */ nread = locate_read_str (&path, &pathsize, fp, 0, count); if (nread < 0)