Source-Changes-HG archive

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

[src/trunk]: src/sys/netkey if 2nd parameter of key_acquire() is NULL it panics.



details:   https://anonhg.NetBSD.org/src/rev/ca79bac91b5a
branches:  trunk
changeset: 502024:ca79bac91b5a
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Jan 10 18:52:51 2001 +0000

description:
if 2nd parameter of key_acquire() is NULL it panics.
key_acquire () does not really require 2nd argument.
1.179 -> 1.180 on kame.

diffstat:

 sys/netkey/key.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (53 lines):

diff -r 902cc67727ab -r ca79bac91b5a sys/netkey/key.c
--- a/sys/netkey/key.c  Wed Jan 10 18:38:37 2001 +0000
+++ b/sys/netkey/key.c  Wed Jan 10 18:52:51 2001 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: key.c,v 1.40 2000/10/07 12:08:33 itojun Exp $  */
-/*     $KAME: key.c,v 1.170 2000/10/07 12:03:02 itojun Exp $   */
+/*     $NetBSD: key.c,v 1.41 2001/01/10 18:52:51 itojun Exp $  */
+/*     $KAME: key.c,v 1.180 2001/01/10 16:35:27 sakane Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -5525,19 +5525,16 @@
 #ifndef IPSEC_NONBLOCK_ACQUIRE
        struct secacq *newacq;
 #endif
-       struct secpolicyindex *spidx = NULL;
        u_int8_t satype;
        int error = -1;
        u_int32_t seq;
 
        /* sanity check */
-       if (saidx == NULL || sp == NULL)
+       if (saidx == NULL)
                panic("key_acquire: NULL pointer is passed.\n");
        if ((satype = key_proto2satype(saidx->proto)) == 0)
                panic("key_acquire: invalid proto is passed.\n");
 
-       spidx = &sp->spidx;
-
 #ifndef IPSEC_NONBLOCK_ACQUIRE
        /*
         * We never do anything about acquirng SA.  There is anather
@@ -5600,12 +5597,14 @@
        /* XXX proxy address (optional) */
 
        /* set sadb_x_policy */
-       m = key_setsadbxpolicy(sp->policy, sp->spidx.dir, sp->id);
-       if (!m) {
-               error = ENOBUFS;
-               goto fail;
-       }
-       m_cat(result, m);
+       if (sp) {
+               m = key_setsadbxpolicy(sp->policy, sp->spidx.dir, sp->id);
+               if (!m) {
+                       error = ENOBUFS;
+                       goto fail;
+               }
+               m_cat(result, m);
+       }
 
        /* XXX identity (optional) */
 #if 0



Home | Main Index | Thread Index | Old Index