Index: locate/fastfind.c
===================================================================
RCS file: /cvs/src/usr.bin/locate/locate/fastfind.c,v
retrieving revision 1.12
diff -u -p -r1.12 fastfind.c
--- locate/fastfind.c   16 Jan 2015 06:40:09 -0000      1.12
+++ locate/fastfind.c   19 Sep 2015 18:28:30 -0000
@@ -65,7 +65,8 @@ statistic (fp, path_fcodes)
                } else
                        count += c - OFFSET;
 
-               sane_count(count);
+               if (count < 0 || count >= PATH_MAX)
+                       errx(1, "corrupted database");
                for (p = path + count; (c = getc(fp)) > SWITCH; size++)
                        if (c < PARITY) {
                                if (c == UMLAUT) {
@@ -212,7 +213,8 @@ fastfind
                        count += c - OFFSET;
                }
 
-               sane_count(count);
+               if (count < 0 || count >= PATH_MAX)
+                       errx(1, "corrupted database");
                /* overlay old path */
                p = path + count;
                foundchar = p - 1;
Index: locate/locate.c
===================================================================
RCS file: /cvs/src/usr.bin/locate/locate/locate.c,v
retrieving revision 1.26
diff -u -p -r1.26 locate.c
--- locate/locate.c     16 Jan 2015 06:40:09 -0000      1.26
+++ locate/locate.c     19 Sep 2015 18:28:30 -0000
@@ -331,15 +331,6 @@ usage(void)
        exit(1);
 }
 
-void
-sane_count(int count)
-{
-       if (count < 0 || count >= PATH_MAX) {
-               fprintf(stderr, "locate: corrupted database\n");
-               exit(1);
-       }
-}
-
 /* load fastfind functions */
 
 /* statistic */

Reply via email to