Source-Changes-HG archive

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

[src/trunk]: src/sys/netkey avoid null pointer deref



details:   https://anonhg.NetBSD.org/src/rev/de5b76816578
branches:  trunk
changeset: 567111:de5b76816578
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Jun 01 03:05:26 2004 +0000

description:
avoid null pointer deref
remove wrong comment
yamt@netbsd

diffstat:

 sys/netkey/keysock.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r e403b4028633 -r de5b76816578 sys/netkey/keysock.c
--- a/sys/netkey/keysock.c      Tue Jun 01 02:40:00 2004 +0000
+++ b/sys/netkey/keysock.c      Tue Jun 01 03:05:26 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: keysock.c,v 1.35 2004/06/01 02:01:14 itojun Exp $      */
+/*     $NetBSD: keysock.c,v 1.36 2004/06/01 03:05:26 itojun Exp $      */
 /*     $KAME: keysock.c,v 1.32 2003/08/22 05:45:08 itojun Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.35 2004/06/01 02:01:14 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.36 2004/06/01 03:05:26 itojun Exp $");
 
 #include "opt_inet.h"
 
@@ -240,10 +240,8 @@
                        kp->kp_queue = NULL;
                } else
                        m->m_nextpkt = NULL;    /* just for safety */
-       } else {
-               /* NOTE: kp_queue is !NULL */
+       } else
                m->m_nextpkt = NULL;
-       }
 
        for (; m && error == 0; m = n) {
                n = m->m_nextpkt;
@@ -295,8 +293,10 @@
                 * insert m to the head of queue, as normally mbuf on the queue
                 * is less important than others.
                 */
-               m->m_nextpkt = kp->kp_queue;
-               kp->kp_queue = m;
+               if (m) {
+                       m->m_nextpkt = kp->kp_queue;
+                       kp->kp_queue = m;
+               }
        } else {
                /* recover the queue */
                if (!m) {



Home | Main Index | Thread Index | Old Index