Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Decorate struct in6_addr with the __packed attr...



details:   https://anonhg.NetBSD.org/src/rev/b43c942eee5a
branches:  trunk
changeset: 451578:b43c942eee5a
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue May 28 03:56:46 2019 +0000

description:
Decorate struct in6_addr with the __packed attribute

This avoids undefined behavior when accessing misaligned pointers.

Detected by kUBSan.

Patch by Akul Pillai.

diffstat:

 sys/netinet6/in6.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r e9c5357d27d7 -r b43c942eee5a sys/netinet6/in6.h
--- a/sys/netinet6/in6.h        Tue May 28 03:53:28 2019 +0000
+++ b/sys/netinet6/in6.h        Tue May 28 03:56:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.h,v 1.94 2018/12/10 16:28:52 christos Exp $        */
+/*     $NetBSD: in6.h,v 1.95 2019/05/28 03:56:46 kamil Exp $   */
 /*     $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $    */
 
 /*
@@ -126,7 +126,7 @@
                __uint16_t  __u6_addr16[8];
                uint32_t  __u6_addr32[4];
        } __u6_addr;                    /* 128-bit IP6 address */
-};
+} __packed;
 
 #define s6_addr   __u6_addr.__u6_addr8
 #ifdef _KERNEL /* XXX nonstandard */



Home | Main Index | Thread Index | Old Index