Browse code

terminate buffer after recv() call

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1100 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/11/17 01:00:02
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Nov 16 16:58:12 CET 2004 (tk)
2
+---------------------------------
3
+  * freshclam/manager.c: get_database: terminate buffer after recv() call
4
+			 (thanks to Nigel)
5
+
1 6
 Tue Nov 16 16:15:38 CET 2004 (tk)
2 7
 ---------------------------------
3 8
   * clamscan/manager.c: fix duplicate reporting of failure to open some
... ...
@@ -619,7 +619,6 @@ int get_database(const char *dbfile, int socketfd, const char *file, const char
619 619
       }
620 620
 
621 621
       if (i>2 && *ch == '\n' && *(ch - 1) == '\r' && *(ch - 2) == '\n' && *(ch - 3) == '\r') {
622
-	ch++;
623 622
 	i++;
624 623
 	break;
625 624
       }
... ...
@@ -627,6 +626,8 @@ int get_database(const char *dbfile, int socketfd, const char *file, const char
627 627
       i++;
628 628
     }
629 629
 
630
+    buffer[i] = 0;
631
+
630 632
     /* check whether the resource actually existed or not */
631 633
 
632 634
     if ((strstr(buffer, "HTTP/1.1 404")) != NULL) {