While working on the win32-mingw port, I ran across two apparent bugs
for which patches are attached.
The first is a null pointer dereference in report.c and the second is a
configure test that checks for the wrong file in libpng-1.0.8 (was
looking for gd.h not png.h).
cheers,
--Scott
--
Scott Renfro <[EMAIL PROTECTED]>
Patch description:
* in some cases, a component under device[] would be dereferenced wile
still NULL, causing a core dump
* this patch adds additional checking prior to dereferencing
diff -ruN ntop-current/ntop/report.c ntop-current-sgr/ntop/report.c
--- ntop-current/ntop/report.c Mon Nov 05 15:05:20 2001
+++ ntop-current-sgr/ntop/report.c Mon Nov 05 19:39:47 2001
@@ -1919,14 +1919,20 @@
hosts =
(HostTraffic**)malloc(device[actualReportDeviceId].actualHashSize*sizeof(HostTraffic*));
memset(hosts, 0, device[actualReportDeviceId].actualHashSize*sizeof(HostTraffic*));
+
for(i=0; i<device[actualReportDeviceId].actualHashSize; i++)
- if((device[actualReportDeviceId].hash_hostTraffic[i] != NULL)
+ if((device[actualReportDeviceId].hash_hostTraffic != NULL
+ && device[actualReportDeviceId].hash_hostTraffic[i] != NULL)
&& subnetPseudoLocalHost(device[actualReportDeviceId].hash_hostTraffic[i])
- && (device[actualReportDeviceId].hash_hostTraffic[i]->hostNumIpAddress[0] !=
'\0')) {
+ && (device[actualReportDeviceId].hash_hostTraffic[i]->hostNumIpAddress != 0
+ && device[actualReportDeviceId].hash_hostTraffic[i]->hostNumIpAddress[0]
+!= '\0')) {
hosts[hostsNum++] = device[actualReportDeviceId].hash_hostTraffic[i];
for(j=0; j<TOP_ASSIGNED_IP_PORTS; j++) {
- if(device[actualReportDeviceId].hash_hostTraffic[i]->portsUsage[j] != NULL) {
+ if(device[actualReportDeviceId].hash_hostTraffic != NULL
+ && device[actualReportDeviceId].hash_hostTraffic[i] != NULL
+ && device[actualReportDeviceId].hash_hostTraffic[i]->portsUsage != NULL
+ && device[actualReportDeviceId].hash_hostTraffic[i]->portsUsage[j] !=
+NULL) {
clientPorts[j] +=
device[actualReportDeviceId].hash_hostTraffic[i]->portsUsage[j]->clientUses;
serverPorts[j] +=
device[actualReportDeviceId].hash_hostTraffic[i]->portsUsage[j]->serverUses;
numPorts++;
Patch description:
* This patch fixes a typo in the ntop configure script where it
appears to be looking for the wrong header in libpng-1.0.8/
--- ntop/configure.orig Wed Nov 07 19:24:53 2001
+++ ntop/configure Wed Nov 07 19:25:28 2001
@@ -5203,7 +5203,7 @@
test -r ../gdchart0.94c/gd-1.8.3/libgd.a &&
test -r ../gdchart0.94c/gd-1.8.3/gd.h &&
test -r ../gdchart0.94c/gd-1.8.3/libpng-1.0.8/libpng.a &&
- test -r ../gdchart0.94c/gd-1.8.3/libpng-1.0.8/gd.h; then
+ test -r ../gdchart0.94c/gd-1.8.3/libpng-1.0.8/png.h; then
GDCHART_ROOT="../gdchart0.94c"
GDCHART_ROOT=`cd ${GDCHART_ROOT} && pwd`
MORELIBS="${MORELIBS} -L$GDCHART_ROOT -lgdchart -L$GDCHART_ROOT/gd-1.8.3
-lgd -L$GDCHART_ROOT/gd-1.8.3/libpng-1.0.8 -lpng"