Browse code

Correct nul termination in ping response from clamd

git-svn: trunk@3468

Nigel Horne authored on 2007/12/30 00:39:58
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sat Dec 29 15:05:11 GMT 2007 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Correct nul termination in ping response from clamd
4
+
1 5
 Sat Dec 29 16:02:47 EET 2007 (edwin)
2 6
 ------------------------------------
3 7
   * libclamav: the ugly hack isn't needed on Solaris after all, if building
... ...
@@ -33,7 +33,7 @@
33 33
  */
34 34
 static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.312 2007/02/12 22:24:21 njh Exp $";
35 35
 
36
-#define	CM_VERSION	"devel-20071220"
36
+#define	CM_VERSION	"devel-20071229"
37 37
 
38 38
 #if HAVE_CONFIG_H
39 39
 #include "clamav-config.h"
... ...
@@ -2293,7 +2293,7 @@ pingServer(int serverNumber)
2293 2293
 	if(nbytes == 0)
2294 2294
 		return 0;
2295 2295
 
2296
-	buf[nbytes] = '\0';
2296
+	buf[nbytes - 1] = '\0';
2297 2297
 
2298 2298
 	/* Remove the trailing new line from the reply */
2299 2299
 	if((ptr = strchr(buf, '\n')) != NULL)
... ...
@@ -2542,7 +2542,8 @@ findServer(void)
2542 2542
 /*
2543 2543
  * How many servers are up at the moment? If a server is marked as down,
2544 2544
  *	don't keep on flooding it with requests to see if it's now back up
2545
- * If only one server is active, let the caller know
2545
+ * If only one server is active, let the caller know, which server is the
2546
+ *	active one
2546 2547
  */
2547 2548
 static int
2548 2549
 active_servers(int *active)
... ...
@@ -2617,6 +2618,8 @@ try_server(void *var)
2617 2617
 
2618 2618
 /*
2619 2619
  * Sendmail wants to establish a connexion to us
2620
+ * TODO: is it possible (desirable?) to determine if the remote machine has been
2621
+ *	compromised?
2620 2622
  */
2621 2623
 static sfsistat
2622 2624
 clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)