#3 fix for segfault in DropOldData

closed
nobody
None
5
2003-11-10
2003-11-01
Hannes Reich
No

In the right circumstances, DropOldData() will
dereference a null pointer. The attached patch file
corrects this problem (tested with version 1.1.4 and
1.1.5).

Details: If no traffic for a particular IP address is
seen for a long time, all of its traffic data will
eventually be culled by DropOldData(). If the IP
address happens to be the first one in the IPDataStore
list, then the result is that IPDataStore->FirstBlock
becomes a null pointer. This causes a segfault on line
304 of bandwidthd.c.

The simple fix implemented here is to check if
DataStore->FirstBlock is non-null before dereferencing
it. A nicer solution would be to properly remove the
first IPDataStore entry from the list just like any
other, but I'll leave that as an exercise...

Incidentally, the "make count data persistent across
restarts" patch was useful in reproducing and debugging
this crash, as I was able to use the CDF file generated
when the crash occurred, and "replay" the sequence of
events that caused it.

Discussion

  • David R Hinkle
    David R Hinkle
    2003-11-03

    Logged In: YES
    user_id=863707

    Thanks for this Patch Hannes, I just cought this bug today,
    and it will be fixed in 1.1.6.

     
  • David R Hinkle
    David R Hinkle
    2003-11-10

    • status: open --> closed