Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Fix late NULL-checking (CID 1427782: Null point...



details:   https://anonhg.NetBSD.org/src/rev/0aed30e8b3e5
branches:  trunk
changeset: 829231:0aed30e8b3e5
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jan 23 02:17:32 2018 +0000

description:
Fix late NULL-checking (CID 1427782: Null pointer dereferences (REVERSE_INULL))

diffstat:

 sys/netipsec/ipsec.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 69db77029d50 -r 0aed30e8b3e5 sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c      Mon Jan 22 23:20:26 2018 +0000
+++ b/sys/netipsec/ipsec.c      Tue Jan 23 02:17:32 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec.c,v 1.123 2017/11/21 07:03:08 ozaki-r Exp $      */
+/*     $NetBSD: ipsec.c,v 1.124 2018/01/23 02:17:32 ozaki-r Exp $      */
 /*     $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $       */
 /*     $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.123 2017/11/21 07:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.124 2018/01/23 02:17:32 ozaki-r Exp $");
 
 /*
  * IPsec controller part.
@@ -1444,11 +1444,10 @@
        struct secpolicy **policy;
 
        KASSERT(!cpu_softintr_p());
+       KASSERT(inp != NULL);
        KASSERT(inp_locked(inp));
+       KASSERT(request != NULL);
 
-       /* sanity check. */
-       if (inp == NULL || request == NULL)
-               return EINVAL;
        if (len < sizeof(*xpl))
                return EINVAL;
        xpl = (const struct sadb_x_policy *)request;



Home | Main Index | Thread Index | Old Index