Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/locate/locate PR/32799: David H. Gutteridge: Apparen...



details:   https://anonhg.NetBSD.org/src/rev/a97b65f26c97
branches:  trunk
changeset: 588214:a97b65f26c97
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Feb 12 00:45:01 2006 +0000

description:
PR/32799: David H. Gutteridge: Apparent off-by-one error in locate(1) causes
incorrect behaviour when entries with the maximum path length are encountered

diffstat:

 usr.bin/locate/locate/locate.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 681694f5a3a0 -r a97b65f26c97 usr.bin/locate/locate/locate.c
--- a/usr.bin/locate/locate/locate.c    Sun Feb 12 00:18:30 2006 +0000
+++ b/usr.bin/locate/locate/locate.c    Sun Feb 12 00:45:01 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locate.c,v 1.13 2003/08/07 11:14:21 agc Exp $  */
+/*     $NetBSD: locate.c,v 1.14 2006/02/12 00:45:01 christos Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)locate.c   8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: locate.c,v 1.13 2003/08/07 11:14:21 agc Exp $");
+__RCSID("$NetBSD: locate.c,v 1.14 2006/02/12 00:45:01 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -206,7 +206,7 @@
                /* overlay old path */
                for (p = path + count; (c = getc(fp)) > SWITCH;) {
                        /* sanity check */
-                       if (p < path || p >= path + sizeof(path) - 2)
+                       if (p < path || p >= path + sizeof(path) - 1)
                                return -1;      /* invalid database file */
                        if (c < PARITY)
                                *p++ = c;



Home | Main Index | Thread Index | Old Index