Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Fix ipsec4_get_ulp(). We should do "goto done" ...



details:   https://anonhg.NetBSD.org/src/rev/bf29d3e2ffc7
branches:  trunk
changeset: 829995:bf29d3e2ffc7
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Feb 21 16:42:33 2018 +0000

description:
Fix ipsec4_get_ulp(). We should do "goto done" instead of "return",
otherwise the port fields of spidx are uninitialized.

ok mlelstv@

diffstat:

 sys/netipsec/ipsec.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r f488bd05af3d -r bf29d3e2ffc7 sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c      Wed Feb 21 16:38:15 2018 +0000
+++ b/sys/netipsec/ipsec.c      Wed Feb 21 16:42:33 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.133 2018/02/21 16:38:15 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.134 2018/02/21 16:42:33 maxv Exp $ */
 /* $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.133 2018/02/21 16:38:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.134 2018/02/21 16:42:33 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1049,7 +1049,7 @@
                case IPPROTO_ICMP:
                        spidx->ul_proto = nxt;
                        if (off + sizeof(struct icmp) > m->m_pkthdr.len)
-                               return;
+                               goto done;
                        m_copydata(m, off, sizeof(icmph), &icmph);
                        ((struct sockaddr_in *)&spidx->src)->sin_port =
                            htons((uint16_t)icmph.icmp_type);



Home | Main Index | Thread Index | Old Index