[git] GnuPG - branch, master, updated. gnupg-2.1.19-94-g6466540

by Werner Koch cvs at cvs.gnupg.org
Thu Mar 30 10:38:46 CEST 2017


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  64665404e43051fa50ee030766347e24b7d1e4d5 (commit)
      from  a8895c99a7d0750132477d80cd66caaf3a709113 (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 64665404e43051fa50ee030766347e24b7d1e4d5
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Mar 30 10:35:20 2017 +0200

    gpg: Fix export porting of zero length user ID packets.
    
    * g10/build-packet.c (do_user_id): Avoid indeterminate length header.
    --
    
    We are able to import such user ids but when exporting them the
    exported data could not be imported again because the parser bails out
    on invalid keyrings.  This is now fixed and should be backported.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/build-packet.c b/g10/build-packet.c
index 60e7d45..1ee57e0 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -415,18 +415,26 @@ static int
 do_user_id( IOBUF out, int ctb, PKT_user_id *uid )
 {
   int rc;
+  int hdrlen;
 
   log_assert (ctb_pkttype (ctb) == PKT_USER_ID
               || ctb_pkttype (ctb) == PKT_ATTRIBUTE);
 
+  /* We need to take special care that doe user ID with a length of 0:
+   * Without forcing HDRLEN to 2 in this case an indeterminate length
+   * packet would be written which is not allowed.  Note that we are
+   * always called with a CTB indicating an old packet header format,
+   * so that forcing a 2 octet header works.  */
   if (uid->attrib_data)
     {
-      write_header(out, ctb, uid->attrib_len);
+      hdrlen = uid->attrib_len? 0 : 2;
+      write_header2 (out, ctb, uid->attrib_len, hdrlen);
       rc = iobuf_write( out, uid->attrib_data, uid->attrib_len );
     }
   else
     {
-      write_header2( out, ctb, uid->len, 0 );
+      hdrlen = uid->len? 0 : 2;
+      write_header2 (out, ctb, uid->len, hdrlen);
       rc = iobuf_write( out, uid->name, uid->len );
     }
   return rc;

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

Summary of changes:
 g10/build-packet.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)


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




More information about the Gnupg-commits mailing list