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.
This commit is contained in:
christos 2013-10-19 00:57:41 +00:00
parent f304780793
commit 52ebde656f

View File

@ -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 @@ trace_loop(char *argv[])
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 @@ query_loop(char *argv[], int argc)
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;