Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/netkey Pull up revision 1.41 (requested by itojun):



details:   https://anonhg.NetBSD.org/src/rev/c8d5c3538fc0
branches:  netbsd-1-5
changeset: 490636:c8d5c3538fc0
user:      he <he%NetBSD.org@localhost>
date:      Sun Feb 04 18:28:09 2001 +0000

description:
Pull up revision 1.41 (requested by itojun):
  Avoid panic if second (optional) argument is NULL.

diffstat:

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

diffs (53 lines):

diff -r d168aeb20783 -r c8d5c3538fc0 sys/netkey/key.c
--- a/sys/netkey/key.c  Sat Feb 03 22:33:45 2001 +0000
+++ b/sys/netkey/key.c  Sun Feb 04 18:28:09 2001 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: key.c,v 1.23.2.9 2000/10/08 13:27:40 itojun Exp $      */
-/*     $KAME: key.c,v 1.170 2000/10/07 12:03:02 itojun Exp $   */
+/*     $NetBSD: key.c,v 1.23.2.10 2001/02/04 18:28:09 he 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