Source-Changes-HG archive

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

[src/trunk]: src/sbin/mount_portal Fix bug where NULL pointer wasn't checked ...



details:   https://anonhg.NetBSD.org/src/rev/9017d6ae7cd5
branches:  trunk
changeset: 480654:9017d6ae7cd5
user:      bgrayson <bgrayson%NetBSD.org@localhost>
date:      Mon Jan 17 07:21:54 2000 +0000

description:
Fix bug where NULL pointer wasn't checked before dereferencing

diffstat:

 sbin/mount_portal/pt_filter.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r aa2cab2a2ace -r 9017d6ae7cd5 sbin/mount_portal/pt_filter.c
--- a/sbin/mount_portal/pt_filter.c     Mon Jan 17 07:21:25 2000 +0000
+++ b/sbin/mount_portal/pt_filter.c     Mon Jan 17 07:21:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pt_filter.c,v 1.2 1999/08/17 15:05:15 kleink Exp $     */
+/*     $NetBSD: pt_filter.c,v 1.3 2000/01/17 07:21:54 bgrayson Exp $   */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: pt_filter.c,v 1.2 1999/08/17 15:05:15 kleink Exp $");
+__RCSID("$NetBSD: pt_filter.c,v 1.3 2000/01/17 07:21:54 bgrayson Exp $");
 #endif                         /* not lint */
 
 #include <stdio.h>
@@ -130,7 +130,10 @@
         * is equivalent to
         *   bogus1 rfilter bogus1/ cmd1 %s
         */
-       if (strlen(v[3]) == 0)
+       /*
+        * v[3] could be NULL, or could point to "".
+        */
+       if (!v[3] || strlen(v[3]) == 0)
          v[3] = "%s";  /* Handle above assumption. */
        path = key;
        /* Strip out stripkey if it matches leading part of key. */



Home | Main Index | Thread Index | Old Index