On Sun, Oct 23, 2011 at 3:02 PM, Magnus Fromreide <[email protected]>wrote:
> On Sun, Oct 23, 2011 at 01:01:13PM +0200, Bart Van Assche wrote:
> > While reviewing the source code in
> > agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c I came across
> > this:
> >
> > @@ -215,6 +215,13 @@
> > _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container
> > *container,
> > continue;
> > }
> >
> > + /* restore the interface name if we modifed it due to unaliasing
> > + * above
> > + */
> > + if (entry->flags | NETSNMP_ACCESS_IPADDRESS_ISALIAS) {
> > + memcpy(ifrp->ifr_name, extras->name, sizeof(extras->name));
> > + }
> > +
> > /*
> > * get broadcast
> > */
> >
> > Am I the only one who considers this code as obviously broken ?
>
> No. I agree, it seems to always copy 4 or 8 bytes. Good catch.
>
Since _ioctl_extras.name is declared as an array, using sizeof(extras->name)
should be fine. Actually I was referring to the " |
NETSNMP_ACCESS_IPADDRESS_ISALIAS" part which causes the condition always to
evaluate to true. Shouldn't that be "& ..." instead ?
Bart.
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders