Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Fix a null pointer dereference in the case where...



details:   https://anonhg.NetBSD.org/src/rev/32ce00afdcf0
branches:  trunk
changeset: 467891:32ce00afdcf0
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Tue Mar 30 19:02:56 1999 +0000

description:
Fix a null pointer dereference in the case where forwarding is turned on and
there are interfaces up but with no addresses.

diffstat:

 sys/netinet/ip_icmp.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r b7d7d8721657 -r 32ce00afdcf0 sys/netinet/ip_icmp.c
--- a/sys/netinet/ip_icmp.c     Tue Mar 30 18:50:01 1999 +0000
+++ b/sys/netinet/ip_icmp.c     Tue Mar 30 19:02:56 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_icmp.c,v 1.35 1999/01/19 23:39:57 mycroft Exp $     */
+/*     $NetBSD: ip_icmp.c,v 1.36 1999/03/30 19:02:56 mycroft Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -522,6 +522,15 @@
                                continue;
                        break;
                }
+       /*
+        * If we still didn't find an address, punt.  We could have an
+        * interface up (and receiving packets) with no address.
+        */
+       if (ia == (struct in_ifaddr *)0) {
+               m_freem(m);
+               goto done;
+       }
+
        t = ia->ia_addr.sin_addr;
        ip->ip_src = t;
        ip->ip_ttl = MAXTTL;



Home | Main Index | Thread Index | Old Index