[git] GnuPG - branch, master, updated. gnupg-2.1.15-213-gfb3b3e1

by NIIBE Yutaka cvs at cvs.gnupg.org
Fri Oct 7 12:01:59 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  fb3b3e1e7a4219f61a834fd07809898918611c2f (commit)
      from  1a24c67e20e6ccc6c8e37403a26c715c0f1b6216 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fb3b3e1e7a4219f61a834fd07809898918611c2f
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Oct 7 19:00:10 2016 +0900

    agent: Fix get_socket_name.
    
    * agent/gpg-agent.c (get_socket_name): Fix the size of copying.
    
    --
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 70d9775..32e072b 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -599,19 +599,21 @@ get_socket_name (int fd)
     log_error ("socket name not present for file descriptor %d\n", fd);
   else if (len > sizeof(un))
     log_error ("socket name for file descriptor %d was truncated "
-               "(passed %lu bytes, wanted %u)\n", fd, sizeof(un), len);
+               "(passed %zu bytes, wanted %u)\n", fd, sizeof(un), len);
   else
     {
-      log_debug ("file descriptor %d has path %s (%lu octets)\n", fd,
-                 un.sun_path, len - offsetof (struct sockaddr_un, sun_path));
-      name = xtrymalloc (len - offsetof (struct sockaddr_un, sun_path) + 1);
+      size_t namelen = len - offsetof (struct sockaddr_un, sun_path);
+
+      log_debug ("file descriptor %d has path %s (%zu octets)\n", fd,
+                 un.sun_path, namelen);
+      name = xtrymalloc (namelen + 1);
       if (!name)
         log_error ("failed to allocate memory for name of fd %d: %s\n",
                    fd, gpg_strerror (gpg_error_from_syserror ()));
       else
         {
-          memcpy (name, un.sun_path, len);
-          name[len] = 0;
+          memcpy (name, un.sun_path, namelen);
+          name[namelen] = 0;
         }
     }
 

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

Summary of changes:
 agent/gpg-agent.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list