Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/netinet Pull up revision 1.102 (requested by darren...



details:   https://anonhg.NetBSD.org/src/rev/55928a7a00b2
branches:  netbsd-1-6
changeset: 529102:55928a7a00b2
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Sep 30 13:05:29 2002 +0000

description:
Pull up revision 1.102 (requested by darrenr in ticket #842):
>From FreeBSD (1.164) courtesy of Maxim Konovalov:
"In rare cases when there is no room for ip options ip_insertoptions()
can fail and corrupt a header length.  Initialize len and check what
ip_insertoptions() returns."

diffstat:

 sys/netinet/ip_output.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 7baa05a8c2d8 -r 55928a7a00b2 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Mon Sep 30 13:00:59 2002 +0000
+++ b/sys/netinet/ip_output.c   Mon Sep 30 13:05:29 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.95 2002/02/07 21:47:45 thorpej Exp $   */
+/*     $NetBSD: ip_output.c,v 1.95.10.1 2002/09/30 13:05:29 lukem Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.95 2002/02/07 21:47:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.95.10.1 2002/09/30 13:05:29 lukem Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_ipsec.h"
@@ -186,6 +186,7 @@
 #endif /*IPSEC*/
        u_int16_t ip_len;
 
+       len = 0;
        va_start(ap, m0);
        opt = va_arg(ap, struct mbuf *);
        ro = va_arg(ap, struct route *);
@@ -208,7 +209,8 @@
 #endif
        if (opt) {
                m = ip_insertoptions(m, opt, &len);
-               hlen = len;
+               if (len >= sizeof(struct ip))
+                       hlen = len;
        }
        ip = mtod(m, struct ip *);
        /*



Home | Main Index | Thread Index | Old Index