On Tue, Oct 14, 2003 at 09:52:16AM +0200, Stefan Kaltenbrunner wrote:
> There seems to be a problem with the new TCPAddr support in the latest 
> snapshots  - setting TCPSocket without setting TCPAddr (happens for 
> example when upgrading from an older version) "reliably" segfaults upon 
> startup on my system (Debian Testing/x86).

Yeah I get the same here, try the attached patch which should resolve that
particular problem.
-- 
 Damien
diff -Nru clamav-devel-20031014.vanilla/clamd/tcpserver.c 
clamav-devel-20031014/clamd/tcpserver.c
--- clamav-devel-20031014.vanilla/clamd/tcpserver.c     2003-09-29 21:44:52.000000000 
+1000
+++ clamav-devel-20031014/clamd/tcpserver.c     2003-10-15 08:49:56.000000000 +1000
@@ -35,16 +35,16 @@
        struct sockaddr_in server;
        int sockfd, backlog;
        struct cfgstruct *cpt;
+       struct cfgstruct *taddr;
        char *estr;
-       const char *taddr;
 
     memset((char *) &server, 0, sizeof(server));
     server.sin_family = AF_INET;
     server.sin_port = htons(cfgopt(copt, "TCPSocket")->numarg);
-    taddr = cfgopt(copt, "TCPAddr")->strarg;
-    if ( taddr != NULL && *taddr )
+
+    if (taddr = cfgopt(copt, "TCPAddr"))
     {
-       server.sin_addr.s_addr = inet_addr( taddr );
+       server.sin_addr.s_addr = inet_addr( taddr->strarg );
     }else
     {
        server.sin_addr.s_addr = INADDR_ANY;
@@ -64,8 +64,8 @@
        logg("!bind() error: %s\n", estr);
        exit(1);
     } else {
-       if ( taddr != NULL && *taddr )
-           logg("Bound to address %s on port %d\n", taddr, cfgopt(copt, 
"TCPSocket")->numarg);
+       if ( taddr != NULL && *taddr->strarg )
+           logg("Bound to address %s on port %d\n", taddr->strarg, cfgopt(copt, 
"TCPSocket")->numarg);
        else
            logg("Bound to port %d\n", cfgopt(copt, "TCPSocket")->numarg);
     }

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to