Source-Changes-HG archive

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

[src/trunk]: src/libexec/ld.elf_so Add some sanity checking inspired by gcc -...



details:   https://anonhg.NetBSD.org/src/rev/f0c9775df698
branches:  trunk
changeset: 581417:f0c9775df698
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Jun 01 14:57:22 2005 +0000

description:
Add some sanity checking inspired by gcc -Wuninitialized.

diffstat:

 libexec/ld.elf_so/paths.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r ed6d1b18e29f -r f0c9775df698 libexec/ld.elf_so/paths.c
--- a/libexec/ld.elf_so/paths.c Wed Jun 01 14:15:46 2005 +0000
+++ b/libexec/ld.elf_so/paths.c Wed Jun 01 14:57:22 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: paths.c,v 1.32 2004/10/22 05:39:56 skrll Exp $  */
+/*     $NetBSD: paths.c,v 1.33 2005/06/01 14:57:22 lukem Exp $  */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: paths.c,v 1.32 2004/10/22 05:39:56 skrll Exp $");
+__RCSID("$NetBSD: paths.c,v 1.33 2005/06/01 14:57:22 lukem Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -406,6 +406,7 @@
 
        ep = name + strlen(name);
        do {
+               i = -1;
                while (*name == '/' || *name == '.')
                        name++;
                if (name >= ep)
@@ -442,7 +443,7 @@
                        }
        } while (name < ep && miblen <= CTL_MAXNAME);
 
-       if (name < ep)
+       if (name < ep || i == -1)
                goto bad;
        r = SYSCTL_TYPE(result[i].sysctl_flags);
 



Home | Main Index | Thread Index | Old Index