Those look ok ... look for 'em in the cvs after I make sure they compile.

Although if I'm reading it right on a quick look, I don't like the whole
thing - you're got a saved value in maxHosts, but there's conceptually
nothing to prevent a burst of hosts showing up in the interval (outgoing
packet scan, for example), such that there are no free slots in the table
and the while loop would then never end.

-----Burton

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf
> Of Meloun Michal
> Sent: Wednesday, February 04, 2004 7:07 AM
> To: [EMAIL PROTECTED]
> Subject: [Ntop-dev] [PATCH] Domain stats - access out of array bounds
>
>
> Two small corrections. Size of stats[] is maxHosts (in both cases).
> Michal Meloun
>
> --- report.c.orig     Tue Feb  3 05:48:08 2004
> +++ report.c  Wed Feb  4 13:48:31 2004
> @@ -4290,7 +4290,7 @@
>
>        while((stats[keyValue] != NULL)
>           &&
> (strcasecmp(stats[keyValue]->domainHost->fullDomainName,
> el->fullDomainName) != 0))
> -     keyValue = (keyValue+1) %
> myGlobals.device[myGlobals.actualReportDeviceId].actualHashSize;
> +     keyValue = (keyValue+1) % maxHosts;
>
>        if(stats[keyValue] != NULL)
>       statsEntry = stats[keyValue];
>
>
>
> --- plugins/rrdPlugin.c.orig  Wed Feb  4 13:44:08 2004
> +++ plugins/rrdPlugin.c       Wed Feb  4 13:46:21 2004
> @@ -1614,7 +1614,7 @@
>           while((stats[keyValue] != NULL)
>             && (strcasecmp(stats[keyValue]->domainHost->fullDomainName,
>             el->fullDomainName) != 0))
> -             keyValue = (keyValue+1) %
> myGlobals.device[devIdx].actualHashSize;
> +             keyValue = (keyValue+1) % maxHosts;
>
>           // if we just start counting for this domain...
>           if(stats[keyValue] != NULL)
>
>
> _______________________________________________
> Ntop-dev mailing list
> [EMAIL PROTECTED]
> http://listgateway.unipi.it/mailman/listinfo/ntop-dev
>

_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev

Reply via email to