The branch, master has been updated
       via  088410e swrap: Don't pass NULL pointers to memcpy()
      from  12c6934 Bump version to 1.3.3

https://git.samba.org/?p=socket_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 088410edfe5e1cd01bd5cfcd0b8f0016e8fade7d
Author: Joseph Sutton <josephsut...@catalyst.net.nz>
Date:   Fri Jul 30 11:12:12 2021 +1200

    swrap: Don't pass NULL pointers to memcpy()
    
    Doing so is undefined behaviour.
    
    Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz>
    Reviewed-by: Andreas Schneider <a...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/socket_wrapper.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 44cfad8..8141b8b 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -6285,9 +6285,11 @@ static void swrap_sendmsg_after(int fd,
 
        for (i = 0; i < (size_t)msg->msg_iovlen; i++) {
                size_t this_time = MIN(remain, (size_t)msg->msg_iov[i].iov_len);
-               memcpy(buf + ofs,
-                      msg->msg_iov[i].iov_base,
-                      this_time);
+               if (this_time > 0) {
+                       memcpy(buf + ofs,
+                              msg->msg_iov[i].iov_base,
+                              this_time);
+               }
                ofs += this_time;
                remain -= this_time;
        }


-- 
Socket Wrapper Repository

Reply via email to