This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SNMP lockup


On 2009-05-08, Grant Edwards <grante@visi.com> wrote:
> On 2009-05-08, Grant Edwards <grante@visi.com> wrote:
>
>> It appears that in mibgroup/mibII/interfaces.c, the call to 
>>
>>   cyg_snmp_get_if(if_num)
>>
>> with if_num==0 never returns.
>
>     struct ifnet *cyg_snmp_get_if(int if_num) {
>       int index = 0;
>       struct ifnet *ifp;
>       
>       do {
>         while(0 == ifnet_addrs[index])
>           index++;
>     
>         ifp = ifnet_addrs[index]->ifa_ifp;
>         
>         if_num--;       
>         index++;
>       } while (if_num);
>     
>       return ifp;
>     }
>
> If the above code is called with if_num==0, won't it decrement
> it to -1, and then loop 2^32 times before giving up?

And returning a rogue pointer...

-- 
Grant Edwards                   grante             Yow! I wish I was a
                                  at               sex-starved manicurist
                               visi.com            found dead in the Bronx!!


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]