tcpcheck segfault
Brought to you by:
dga,
kevin_kadow
ralf@monster:~/autostatus$ ./tcpcheck 0.1 foo.bar:80
brainbot.com:80
foo.bar failed. could not resolve address
brainbot.com:80 failed: timed out
Segmentation fault (core dumped)
The following patch solves the problem:
diff -u -r1.1.1.1 tcpcheck.c
--- tcpcheck.c 2000/05/05 15:17:01 1.1.1.1
+++ tcpcheck.c 2001/05/06 12:20:10
@@ -307,7 +307,7 @@
/* Now clean up the remainder... they timed out. */
for (i = 0; i < numcons; i++) {
- if (cons[i]->status == 0) {
+ if (cons[i] != NULL && cons[i]->status == 0) {
printf("%s:%d failed: timed out\n",
cons[i]->hostname, cons[i]->port);
}