[exim-dev] [Bug 1628] New: Deprecated calls to bzero()/bcopy…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: admin
Date:  
À: exim-dev
Sujet: [exim-dev] [Bug 1628] New: Deprecated calls to bzero()/bcopy() in Exim-4.85
https://bugs.exim.org/show_bug.cgi?id=1628

            Bug ID: 1628
           Summary: Deprecated calls to bzero()/bcopy() in Exim-4.85
           Product: Exim
           Version: 4.85
          Hardware: All
                OS: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Unfiled
          Assignee: nigel@???
          Reporter: wp02855@???
                CC: exim-dev@???


Created attachment 808
--> https://bugs.exim.org/attachment.cgi?id=808&action=edit
Patch file for above bug report...

Hello All,

In reviewing code in Exim-4.85, I found instances of deprecated
calls to bzero()/bcopy() which should be converted to memset()/
memcpy()/memmove().

In 'src/dcc.c' the following patch file converts all bzero()
calls to memset():

--- dcc.c.orig  2015-05-07 13:29:16.844609728 -0700
+++ dcc.c       2015-05-07 13:37:03.306894686 -0700
@@ -124,7 +124,7 @@


/* Initialize the variables */

-  bzero(sockip,sizeof(sockip));
+  memset(sockip,0,sizeof(sockip));
   if (dccifd_address) {
     if (dccifd_address[0] == '/')
       Ustrncpy(sockpath, dccifd_address, sizeof(sockpath));
@@ -139,7 +139,7 @@


/* opts is what we send as dccifd options - see man dccifd */
/* We don't support any other option than 'header' so just copy that */
- bzero(opts,sizeof(opts));
+ memset(opts,0,sizeof(opts));
Ustrncpy(opts, dccifd_options, sizeof(opts)-1);
/* if $acl_m_dcc_override_client_ip is set use it */
if (((override_client_ip = expand_string(US"$acl_m_dcc_override_client_ip"))
!= NULL) &&
@@ -172,10 +172,10 @@
/* we set the default return value to DEFER */
retval = DEFER;

- bzero(sendbuf,sizeof(sendbuf));
- bzero(dcc_header_str,sizeof(dcc_header_str));
- bzero(rcpt,sizeof(rcpt));
- bzero(from,sizeof(from));
+ memset(sendbuf,0,sizeof(sendbuf));
+ memset(dcc_header_str,0,sizeof(dcc_header_str));
+ memset(rcpt,0,sizeof(rcpt));
+ memset(from,0,sizeof(from));

   /* send a null return path as "<>". */
   if (Ustrlen(sender_address) > 0)
@@ -191,7 +191,7 @@
   /* If sockip contains an ip, we use a tcp socket, otherwise a UNIX socket */
   if(Ustrcmp(sockip, "")){
     ipaddress = gethostbyname((char *)sockip);
-    bzero((char *) &serv_addr_in, sizeof(serv_addr_in));
+    memset((char *) &serv_addr_in, '\0', sizeof(serv_addr_in));
     serv_addr_in.sin_family = AF_INET;
     bcopy((char *)ipaddress->h_addr, (char *)&serv_addr_in.sin_addr.s_addr,
ipaddress->h_length);
     serv_addr_in.sin_port = htons(portnr);
@@ -214,7 +214,7 @@
     }
   } else {
     /* connecting to the dccifd UNIX socket */
-    bzero((char *)&serv_addr,sizeof(serv_addr));
+    memset((char *)&serv_addr,'\0',sizeof(serv_addr));
     serv_addr.sun_family = AF_UNIX;
     Ustrcpy(serv_addr.sun_path, sockpath);
     if ((sockfd = socket(AF_UNIX, SOCK_STREAM,0)) < 0){
@@ -257,7 +257,7 @@
       DEBUG(D_acl)
         debug_printf("DCC: Writing buffer: %s\n", sendbuf);
       flushbuffer(sockfd, sendbuf);
-      bzero(sendbuf, sizeof(sendbuf));
+      memset(sendbuf, 0, sizeof(sendbuf));
     }
     Ustrncat(sendbuf, recipients_list[i].address,
sizeof(sendbuf)-Ustrlen(sendbuf)-1);
     Ustrncat(sendbuf, "\r\n", sizeof(sendbuf)-Ustrlen(sendbuf)-1);
@@ -271,7 +271,7 @@


   /* now send the message */
   /* Clear the input buffer */
-  bzero(sendbuf, sizeof(sendbuf));
+  memset(sendbuf, 0, sizeof(sendbuf));
   /* First send the headers */
   /* Now send the headers */
   DEBUG(D_acl)
@@ -282,7 +282,7 @@
       /* The size of the header is bigger than the size of
        * the input buffer, so split it up in smaller parts. */
        flushbuffer(sockfd, sendbuf);
-       bzero(sendbuf, sizeof(sendbuf));
+       memset(sendbuf, 0, sizeof(sendbuf));
        j = 0;
        while(j < dcchdr->slen)
        {
@@ -291,11 +291,11 @@
           j++;
         }
         flushbuffer(sockfd, sendbuf);
-        bzero(sendbuf, sizeof(sendbuf));
+        memset(sendbuf, 0, sizeof(sendbuf));
        }
     } else if(Ustrlen(sendbuf) + dcchdr->slen > sizeof(sendbuf)-2) {
       flushbuffer(sockfd, sendbuf);
-      bzero(sendbuf, sizeof(sendbuf));
+      memset(sendbuf, 0, sizeof(sendbuf));
       Ustrncpy(sendbuf, dcchdr->text, sizeof(sendbuf)-2);
     } else {
       Ustrncat(sendbuf, dcchdr->text, sizeof(sendbuf)-Ustrlen(sendbuf)-2);
@@ -309,7 +309,7 @@
     debug_printf("\nDCC: ****************************\n%s", sendbuf);


/* Clear the input buffer */
- bzero(sendbuf, sizeof(sendbuf));
+ memset(sendbuf, 0, sizeof(sendbuf));

   /* now send the body */
   DEBUG(D_acl)
@@ -317,7 +317,7 @@
   (void)fseek(data_file, SPOOL_DATA_START_OFFSET, SEEK_SET);
   while((fread(sendbuf, 1, sizeof(sendbuf)-1, data_file)) > 0) {
     flushbuffer(sockfd, sendbuf);
-    bzero(sendbuf, sizeof(sendbuf));
+    memset(sendbuf, 0, sizeof(sendbuf));
   }
   DEBUG(D_acl)
     debug_printf("\nDCC: ****************************\n");
@@ -356,7 +356,7 @@
   k = 0;       /* initializing the index of the X-DCC header:
dcc_header_str[k] */


   /* Let's read from the socket until there's nothing left to read */
-  bzero(recvbuf, sizeof(recvbuf));
+  memset(recvbuf, 0, sizeof(recvbuf));
   while((resp = read(sockfd, recvbuf, sizeof(recvbuf)-1)) > 0) {
     /* How much did we get from the socket */
     c = Ustrlen(recvbuf) + 1;
@@ -466,7 +466,7 @@
       }
     }
     /* we reinitialize the output buffer before we read again */
-    bzero(recvbuf,sizeof(recvbuf));
+    memset(recvbuf,0,sizeof(recvbuf));
   }
   /* We have read everything from the socket */


I am attaching the patch file to this bug report...

Bill Parker (wp02855 at gmail dot com)

--
You are receiving this mail because:
You are on the CC list for the bug.