Convert all Tom's calls to snprintf() to string_format().
[exim.git] / src / src / malware.c
index a790b284bc7b12e0f9802480d9ced489418622b7..ca9c3dfebd5390d46fa112e3155a35f531c03781 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/malware.c,v 1.11 2005/07/01 10:49:02 ph10 Exp $ */
+/* $Cambridge: exim/src/src/malware.c,v 1.12 2005/08/01 14:41:25 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -199,7 +199,7 @@ int malware(uschar **listptr) {
       /* prepare variables */
       drweb_cmd = htonl(DRWEBD_SCAN_CMD);
       drweb_flags = htonl(DRWEBD_RETURN_VIRUSES | DRWEBD_IS_MAIL);
-      snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml",
+      (void)string_format(scanrequest, 1024,CS"%s/scan/%s/%s.eml",
             spool_directory, message_id, message_id);
 
       /* calc file size */
@@ -287,7 +287,7 @@ int malware(uschar **listptr) {
       /* prepare variables */
       drweb_cmd = htonl(DRWEBD_SCAN_CMD);
       drweb_flags = htonl(DRWEBD_RETURN_VIRUSES | DRWEBD_IS_MAIL);
-      snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml", spool_directory, message_id, message_id);
+      (void)string_format(scanrequest, 1024,CS"%s/scan/%s/%s.eml", spool_directory, message_id, message_id);
       drweb_slen = htonl(Ustrlen(scanrequest));
 
       /* send scan request */
@@ -446,7 +446,7 @@ int malware(uschar **listptr) {
       };
 
       /* prepare our command */
-      snprintf(CS buf, 32768, "SCAN bPQRSTUW %s/scan/%s/%s.eml\r\n", spool_directory, message_id, message_id);
+      (void)string_format(buf, 32768, "SCAN bPQRSTUW %s/scan/%s/%s.eml\r\n", spool_directory, message_id, message_id);
 
       /* and send it */
       if (send(sock, buf, Ustrlen(buf), 0) < 0) {
@@ -479,7 +479,7 @@ int malware(uschar **listptr) {
       }
 
       /* prepare our command */
-      snprintf(CS buf, 32768, "quit\r\n");
+      (void)string_format(buf, 32768, "quit\r\n");
 
       /* and send it */
       if (send(sock, buf, Ustrlen(buf), 0) < 0) {
@@ -571,7 +571,7 @@ int malware(uschar **listptr) {
       };
 
       /* pass the mailfile to fsecure */
-      snprintf(CS file_name,1024,"SCAN\t%s/scan/%s/%s.eml\n", spool_directory, message_id, message_id);
+      (void)string_format(file_name,1024,"SCAN\t%s/scan/%s/%s.eml\n", spool_directory, message_id, message_id);
       /* debug_printf("send scan %s",file_name); */
       if (write(sock, file_name, Ustrlen(file_name)) < 0) {
         (void)close(sock);
@@ -661,7 +661,7 @@ int malware(uschar **listptr) {
       /* get current date and time, build scan request */
       time(&t);
       strftime(CS tmpbuf, sizeof(tmpbuf), "<0>%d %b %H:%M:%S:%%s/scan/%%s", localtime(&t));
-      snprintf(CS scanrequest, 1024,CS tmpbuf, spool_directory, message_id);
+      (void)string_format(scanrequest, 1024,CS tmpbuf, spool_directory, message_id);
 
       /* send scan request */
       if (send(sock, scanrequest, Ustrlen(scanrequest)+1, 0) < 0) {
@@ -854,8 +854,8 @@ int malware(uschar **listptr) {
       };
 
       /* prepare scanner call */
-      snprintf(CS file_name,1024,"%s/scan/%s", spool_directory, message_id);
-      snprintf(CS commandline,1024, CS cmdline_scanner,file_name);
+      (void)string_format(file_name,1024,"%s/scan/%s", spool_directory, message_id);
+      (void)string_format(commandline,1024, CS cmdline_scanner,file_name);
       /* redirect STDERR too */
       Ustrcat(commandline," 2>&1");
 
@@ -872,7 +872,7 @@ int malware(uschar **listptr) {
         return DEFER;
       };
 
-      snprintf(CS file_name,1024,"%s/scan/%s/%s_scanner_output", spool_directory, message_id, message_id);
+      (void)string_format(file_name,1024,"%s/scan/%s/%s_scanner_output", spool_directory, message_id, message_id);
       scanner_record = fopen(CS file_name,"wb");
 
       if (scanner_record == NULL) {
@@ -964,7 +964,7 @@ int malware(uschar **listptr) {
       }
 
       /* pass the scan directory to sophie */
-      snprintf(CS file_name,1024,"%s/scan/%s", spool_directory, message_id);
+      (void)string_format(file_name,1024,"%s/scan/%s", spool_directory, message_id);
       if (write(sock, file_name, Ustrlen(file_name)) < 0) {
         (void)close(sock);
         log_write(0, LOG_MAIN|LOG_PANIC,
@@ -1079,7 +1079,7 @@ int malware(uschar **listptr) {
 
       /* Pass the string to ClamAV (7 = "SCAN \n" + \0) */
 
-          snprintf(CS file_name,1024,"SCAN %s/scan/%s\n", spool_directory, message_id);
+          (void)string_format(file_name,1024,"SCAN %s/scan/%s\n", spool_directory, message_id);
 
           if (send(sock, file_name, Ustrlen(file_name), 0) < 0) {
             (void)close(sock);
@@ -1141,7 +1141,7 @@ int malware(uschar **listptr) {
             return DEFER;
           }
 
-    snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml",
+      (void)string_format(scanrequest, 1024,CS"%s/scan/%s/%s.eml",
       spool_directory, message_id, message_id);
 
     /* calc file size */
@@ -1218,7 +1218,7 @@ int malware(uschar **listptr) {
 
       /* Pass the string to ClamAV (7 = "SCAN \n" + \0) */
 
-      snprintf(CS file_name,1024,"SCAN %s/scan/%s\n", spool_directory, message_id);
+      (void)string_format(file_name,1024,"SCAN %s/scan/%s\n", spool_directory, message_id);
 
       if (send(sock, file_name, Ustrlen(file_name), 0) < 0) {
         (void)close(sock);