NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/44390: ftpd/ftpcmd.y inet6 case has out of range subscripts
The attached patch cures the compiler complaint. It isn't entirely clear to me
why this helps, but it seems like a useful change anyway because it eliminates
a cast.
paul
Index: ftpcmd.y
===================================================================
--- ftpcmd.y (revision 151799)
+++ ftpcmd.y (working copy)
@@ -966,18 +966,31 @@
NUMBER
{
#ifdef INET6
- char *a, *p;
-
+ char *p;
+ struct in6_addr *a;
+
memset(&data_dest, 0, sizeof(data_dest));
data_dest.su_len = sizeof(struct sockaddr_in6);
data_dest.su_family = AF_INET6;
p = (char *)&data_dest.su_port;
p[0] = $39.i; p[1] = $41.i;
- a = (char *)&data_dest.si_su.su_sin6.sin6_addr;
- a[0] = $5.i; a[1] = $7.i; a[2] = $9.i; a[3] = $11.i;
- a[4] = $13.i; a[5] = $15.i; a[6] = $17.i; a[7] = $19.i;
- a[8] = $21.i; a[9] = $23.i; a[10] = $25.i; a[11] =
$27.i;
- a[12] = $29.i; a[13] = $31.i; a[14] = $33.i; a[15] =
$35.i;
+ a = &data_dest.si_su.su_sin6.sin6_addr;
+ a.s6_addr[0] = $5.i;
+ a.s6_addr[1] = $7.i;
+ a.s6_addr[2] = $9.i;
+ a.s6_addr[3] = $11.i;
+ a.s6_addr[4] = $13.i;
+ a.s6_addr[5] = $15.i;
+ a.s6_addr[6] = $17.i;
+ a.s6_addr[7] = $19.i;
+ a.s6_addr[8] = $21.i;
+ a.s6_addr[9] = $23.i;
+ a.s6_addr[10] = $25.i;
+ a.s6_addr[11] = $27.i;
+ a.s6_addr[12] = $29.i;
+ a.s6_addr[13] = $31.i;
+ a.s6_addr[14] = $33.i;
+ a.s6_addr[15] = $35.i;
if (his_addr.su_family == AF_INET6) {
/* XXX: more sanity checks! */
data_dest.su_scope_id = his_addr.su_scope_id;
Home |
Main Index |
Thread Index |
Old Index