Source-Changes-HG archive

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

[src/trunk]: src/sbin/routed/rtquery gcc warns about array bounds limits, but...



details:   https://anonhg.NetBSD.org/src/rev/7c5bdf740bbb
branches:  trunk
changeset: 790660:7c5bdf740bbb
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 19 00:57:41 2013 +0000

description:
gcc warns about array bounds limits, but unfortunately the API here requires
flex arrays in a union which is not allowed. So do a trivial pointer assignment
to baffle gcc again.

diffstat:

 sbin/routed/rtquery/rtquery.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r fec641a59a2e -r 7c5bdf740bbb sbin/routed/rtquery/rtquery.c
--- a/sbin/routed/rtquery/rtquery.c     Sat Oct 19 00:39:39 2013 +0000
+++ b/sbin/routed/rtquery/rtquery.c     Sat Oct 19 00:57:41 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtquery.c,v 1.23 2011/08/29 14:35:04 joerg Exp $       */
+/*     $NetBSD: rtquery.c,v 1.24 2013/10/19 00:57:41 christos Exp $    */
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -63,7 +63,7 @@
 __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\
  The Regents of the University of California.  All rights reserved.");
 #ifdef __NetBSD__
-__RCSID("$NetBSD: rtquery.c,v 1.23 2011/08/29 14:35:04 joerg Exp $");
+__RCSID("$NetBSD: rtquery.c,v 1.24 2013/10/19 00:57:41 christos Exp $");
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD$");
 #else
@@ -372,8 +372,9 @@
 static void
 query_loop(char *argv[], int argc)
 {
-#      define NA0 (OMSG.rip_auths[0])
-#      define NA2 (OMSG.rip_auths[2])
+       struct netauth *na = OMSG.rip_auths;
+#      define NA0 (na[0])
+#      define NA2 (na[2])
        struct seen {
                struct seen *next;
                struct in_addr addr;
@@ -391,14 +392,14 @@
        if (ripv2) {
                OMSG.rip_vers = RIPv2;
                if (auth_type == RIP_AUTH_PW) {
-                       OMSG.rip_nets[1] = OMSG.rip_nets[0];
+                       na[1] = na[0];
                        NA0.a_family = RIP_AF_AUTH;
                        NA0.a_type = RIP_AUTH_PW;
                        memcpy(NA0.au.au_pw, passwd, RIP_AUTH_PW_LEN);
                        omsg_len += sizeof(OMSG.rip_nets[0]);
 
                } else if (auth_type == RIP_AUTH_MD5) {
-                       OMSG.rip_nets[1] = OMSG.rip_nets[0];
+                       na[1] = na[0];
                        NA0.a_family = RIP_AF_AUTH;
                        NA0.a_type = RIP_AUTH_MD5;
                        NA0.au.a_md5.md5_keyid = (int8_t)keyid;



Home | Main Index | Thread Index | Old Index