[git] GnuPG - branch, master, updated. gnupg-2.1.10-87-gc7389ae

by Werner Koch cvs at cvs.gnupg.org
Wed Jan 6 08:56:19 CET 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  c7389ae90fa4a70766400cc241ff6a45aa750324 (commit)
       via  85cc7449fb00ac85b0c2eecd22bd38b23f33edf5 (commit)
       via  09accc0e3d74e6289bed40b5bfc6479981cabfe4 (commit)
       via  7990586828a252e78d2ecacbaaa152431d7e08c8 (commit)
       via  db82b6131d437bf6ba34db0e08b7dfa9edb11e45 (commit)
       via  6deafb92abe100ff67e3a0a230a39e8c0ad41900 (commit)
       via  e64317c15e9960f3173d374e589f7c3565a4ad08 (commit)
       via  1fbfa1bf0a6ad0dc7ed67d12252643c2c6c7370a (commit)
       via  0a00115ee2049ab2357b7a14a51c7da185ffcabd (commit)
      from  e70f7a54f29d727def2cfe9ea5ab9d461b4ce842 (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 c7389ae90fa4a70766400cc241ff6a45aa750324
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:49:45 2016 +0100

    gpg: Silence some regression tests.
    
    * g10/test.c (TEST): Print diagnostics only in verbose mode.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/test.c b/g10/test.c
index 59a015c..39d5945 100644
--- a/g10/test.c
+++ b/g10/test.c
@@ -63,11 +63,12 @@ static int verbose;
     int expected_result;			\
 						\
     tests ++;					\
-						\
-    printf ("%d. Checking %s...",		\
-	    tests, (description) ?: "");	\
-    fflush (stdout);				\
-						\
+    if (verbose)                                \
+      {                                         \
+         printf ("%d. Checking %s...",		\
+	        tests, (description) ?: "");	\
+         fflush (stdout);			\
+      }                                         \
     test_result = (test);			\
     expected_result = (expected);		\
 						\

commit 85cc7449fb00ac85b0c2eecd22bd38b23f33edf5
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:48:44 2016 +0100

    gpg: Avoid using an uninitialized SALT on premature EOF.
    
    * g10/parse-packet.c (parse_key): Check for premature end of salt.
    --
    
    This has no security implications because an arbitrary salt could have
    also been inset by an attacker.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index b0c6ee5..38cd8c9 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -2313,6 +2313,11 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
 		case 3:
 		  for (i = 0; i < 8 && pktlen; i++, pktlen--)
 		    temp[i] = iobuf_get_noeof (inp);
+                  if (i < 8)
+                    {
+		      err = gpg_error (GPG_ERR_INV_PACKET);
+		      goto leave;
+                    }
 		  memcpy (ski->s2k.salt, temp, 8);
 		  break;
 		}

commit 09accc0e3d74e6289bed40b5bfc6479981cabfe4
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:45:01 2016 +0100

    gpg: Silence warnings found by static analyzer.
    
    * g10/keyedit.c (change_passphrase): Remove useless init of ANY.
    (keyedit_quick_adduid): Remove useless setting of ERR.
    * g10/parse-packet.c (parse_key): Remove PKTLEN from condition because
    it has been checked before the loop.
    (parse_plaintext): Remove useless init of PKTLEN.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/keyedit.c b/g10/keyedit.c
index 1c302b7..497fd1b 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -1195,7 +1195,7 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
     }
 
   /* Change the passphrase for all keys.  */
-  for (any = 0, node = keyblock; node; node = node->next)
+  for (node = keyblock; node; node = node->next)
     {
       if (node->pkt->pkttype == PKT_PUBLIC_KEY
 	  || node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
@@ -2391,7 +2391,7 @@ keyedit_quick_adduid (ctrl_t ctrl, const char *username, const char *newuid)
   kdbhd = keydb_new ();
   if (!kdbhd)
     {
-      err = gpg_error_from_syserror ();
+      /* Note that keydb_new has already used log_error.  */
       goto leave;
     }
 
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index d552fa6..b0c6ee5 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -2428,7 +2428,7 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
               err = gpg_error (GPG_ERR_INV_PACKET);
 	      goto leave;
 	    }
-	  for (i = 0; i < ski->ivlen && pktlen; i++, pktlen--)
+	  for (i = 0; i < ski->ivlen; i++, pktlen--)
 	    temp[i] = iobuf_get_noeof (inp);
 	  if (list_mode)
 	    {
@@ -2862,7 +2862,6 @@ parse_plaintext (IOBUF inp, int pkttype, unsigned long pktlen,
     pktlen -= 4;
   pt->len = pktlen;
   pt->buf = inp;
-  pktlen = 0;
 
   if (list_mode)
     {

commit 7990586828a252e78d2ecacbaaa152431d7e08c8
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:42:07 2016 +0100

    gpg: Comment on false positives by static analyzers.
    
    --

diff --git a/g10/encrypt.c b/g10/encrypt.c
index bca1123..eca1c27 100644
--- a/g10/encrypt.c
+++ b/g10/encrypt.c
@@ -326,6 +326,7 @@ encrypt_simple (const char *filename, int mode, int use_seskey)
 
   if (!opt.no_literal)
     {
+      /* Note that PT has been initialized above in no_literal mode.  */
       pt->timestamp = make_timestamp();
       pt->mode = opt.textmode? 't' : 'b';
       pt->len = filesize;
diff --git a/g10/keyedit.c b/g10/keyedit.c
index a303058..1c302b7 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -363,7 +363,13 @@ check_all_keysigs (KBNODE keyblock, int only_selected, int only_selfsigs)
 
           if (only_selfsigs
               && !(keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1]))
-            ;  /* Not a selfsig but we want only selfsigs - skip.  */
+            {
+              /* Not a selfsig but we want only selfsigs - skip.  */
+              /* Static analyzer note: A claim that KEYID above has
+                 garbage is not correct because KEYID is set from the
+                 public key packet which is always the first packet in
+                 a keyblock and thus parsed before this signature.  */
+            }
 	  else if (print_and_check_one_sig (keyblock, node, &inv_sigs,
                                             &no_key, &oth_err, &selfsig,
                                             0, only_selfsigs))
@@ -856,6 +862,14 @@ sign_uids (ctrl_t ctrl, estream_t fp,
 
       if (primary_pk->expiredate && !selfsig)
 	{
+          /* Static analyzer note: A claim that PRIMARY_PK might be
+             NULL is not correct because it set from the public key
+             packet which is always the first packet in a keyblock and
+             parsed in the above loop over the keyblock.  In case the
+             keyblock has no packets at all and thus the loop was not
+             entered the above count_uids_with_flag would have
+             detected this case.  */
+
 	  u32 now = make_timestamp ();
 
 	  if (primary_pk->expiredate <= now)
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index 53b75a6..d552fa6 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -2517,6 +2517,7 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
 	}
     }
 
+  /* Note that KEYID below has been initialized above in list_mode.  */
   if (list_mode)
     es_fprintf (listfp, "\tkeyid: %08lX%08lX\n",
                 (ulong) keyid[0], (ulong) keyid[1]);
diff --git a/g10/sign.c b/g10/sign.c
index 79a5f3b..081bd99 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -601,6 +601,7 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
     if (!opt.no_literal) {
         PACKET pkt;
 
+        /* Note that PT has been initialized above in no_literal mode.  */
         pt->timestamp = make_timestamp ();
         pt->mode = ptmode;
         pt->len = filesize;

commit db82b6131d437bf6ba34db0e08b7dfa9edb11e45
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:39:08 2016 +0100

    kbx: Avoid faulty fclose in an error case.
    
    * kbx/keybox-update.c (blob_filecopy): Do not close an uninitialized
    file pointer after a failure to create a temp file.
    * kbx/keybox-openpgp.c (next_packet): Remove duplicate assignment of
    PKTLEN.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/kbx/keybox-openpgp.c b/kbx/keybox-openpgp.c
index a5f602b..a0e4ab9 100644
--- a/kbx/keybox-openpgp.c
+++ b/kbx/keybox-openpgp.c
@@ -71,7 +71,6 @@ next_packet (unsigned char const **bufptr, size_t *buflen,
   if ( !(ctb & 0x80) )
     return gpg_error (GPG_ERR_INV_PACKET); /* Invalid CTB. */
 
-  pktlen = 0;
   if ((ctb & 0x40))  /* New style (OpenPGP) CTB.  */
     {
       pkttype = (ctb & 0x3f);
diff --git a/kbx/keybox-update.c b/kbx/keybox-update.c
index ef3e330..aa80865 100644
--- a/kbx/keybox-update.c
+++ b/kbx/keybox-update.c
@@ -271,12 +271,11 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
       goto leave;
     }
 
-  /* Create the new file. */
+  /* Create the new file.  On success NEWFP is initialized.  */
   rc = create_tmp_file (fname, &bakfname, &tmpfname, &newfp);
   if (rc)
     {
       fclose (fp);
-      fclose (newfp);
       goto leave;
     }
 

commit 6deafb92abe100ff67e3a0a230a39e8c0ad41900
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:37:03 2016 +0100

    dirmngr: Silence one regression test.
    
    * dirmngr/t-dns-stuff.c (main): Do not print info during standard
    "make check".
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/dirmngr/t-dns-stuff.c b/dirmngr/t-dns-stuff.c
index 3030277..05b39a0 100644
--- a/dirmngr/t-dns-stuff.c
+++ b/dirmngr/t-dns-stuff.c
@@ -155,7 +155,8 @@ main (int argc, char **argv)
       void *key;
       size_t keylen;
 
-      printf ("CERT lookup on '%s'\n", name);
+      if (verbose || any_options)
+        printf ("CERT lookup on '%s'\n", name);
 
       err = get_dns_cert (name, DNS_CERTTYPE_ANY, &key, &keylen,
                           &fpr, &fpr_len, &url);
@@ -164,7 +165,8 @@ main (int argc, char **argv)
                 gpg_strerror (err), gpg_strsource (err));
       else if (key)
         {
-          printf ("Key found (%u bytes)\n", (unsigned int)keylen);
+          if (verbose || any_options)
+            printf ("Key found (%u bytes)\n", (unsigned int)keylen);
         }
       else
         {

commit e64317c15e9960f3173d374e589f7c3565a4ad08
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:35:56 2016 +0100

    common: Avoid warnings about useless assignments.
    
    * common/b64enc.c (b64enc_finish): Remove var assignment which is not
    used later.
    * common/iobuf.c (file_filter): Ditto.
    * common/tlv.c (do_find_tlv): Ditto.
    * common/userids.c (classify_user_id): Ditto.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/b64enc.c b/common/b64enc.c
index 087f27c..9101d98 100644
--- a/common/b64enc.c
+++ b/common/b64enc.c
@@ -348,7 +348,6 @@ b64enc_finish (struct b64state *state)
         {
           for (idx=0; idx < 4; idx++)
             es_putc (tmp[idx], state->stream);
-          idx = 0;
           if (es_ferror (state->stream))
             goto write_error;
         }
@@ -356,7 +355,6 @@ b64enc_finish (struct b64state *state)
         {
           for (idx=0; idx < 4; idx++)
             putc (tmp[idx], state->fp);
-          idx = 0;
           if (ferror (state->fp))
             goto write_error;
         }
diff --git a/common/iobuf.c b/common/iobuf.c
index e8b4a03..d149e2e 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -589,7 +589,6 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf,
 	  if (!a->keep_open)
 	    fd_cache_close (a->no_cache ? NULL : a->fname, f);
 	}
-      f = GNUPG_INVALID_FD;
       xfree (a); /* We can free our context now. */
     }
 
diff --git a/common/tlv.c b/common/tlv.c
index 74cb4a7..1a6c18f 100644
--- a/common/tlv.c
+++ b/common/tlv.c
@@ -59,7 +59,6 @@ do_find_tlv (const unsigned char *buffer, size_t length,
 
   for (;;)
     {
-      buffer = s;
       if (n < 2)
         return NULL; /* Buffer definitely too short for tag and length. */
       if (!*s || *s == 0xff)
diff --git a/common/userids.c b/common/userids.c
index e094c69..b761d14 100644
--- a/common/userids.c
+++ b/common/userids.c
@@ -235,7 +235,6 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
           desc->u.fpr[i] = hextobyte(si);
         for (; i < 20; i++)
           desc->u.fpr[i]= 0;
-        s = se + 1;
         mode = KEYDB_SEARCH_MODE_FPR;
       }
       break;

commit 1fbfa1bf0a6ad0dc7ed67d12252643c2c6c7370a
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:34:14 2016 +0100

    tests: Use info and error instead of a plain echo.
    
    * tests/openpgp/4gb-packet.test: Use error and info.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/tests/openpgp/4gb-packet.test b/tests/openpgp/4gb-packet.test
index 57b8fc7..548ebfe 100755
--- a/tests/openpgp/4gb-packet.test
+++ b/tests/openpgp/4gb-packet.test
@@ -8,9 +8,7 @@ i=$srcdir/4gb-packet.asc
 
 if ! $GPG --list-packets $i >/dev/null
 then
-  echo Failed to parse 4GB packet.
-  exit 1
+  error Failed to parse 4GB packet.
 else
-  echo Can parse 4GB packets.
-  exit 0
+  info Can parse 4GB packets.
 fi

commit 0a00115ee2049ab2357b7a14a51c7da185ffcabd
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 6 08:31:38 2016 +0100

    common: Do not deref vars in tests after a fail().
    
    * common/t-convert.c (test_bin2hex): Turn if conditions into if-else
    chains to avoid accessing unchecked data.
    (test_bin2hexcolon): Ditto.
    * common/t-mapstrings.c (test_map_static_macro_string): Ditto.
    * common/t-stringhelp.c (test_percent_escape): Ditto.
    (test_make_filename_try): Ditto.
    (test_make_absfilename_try): Ditto.
    * common/t-timestuff.c (test_timegm): Ditto.
    --
    
    Note that these dereference only occur after failed regression tests.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/t-convert.c b/common/t-convert.c
index a03c680..ad33dff 100644
--- a/common/t-convert.c
+++ b/common/t-convert.c
@@ -232,13 +232,13 @@ test_bin2hex (void)
   p = bin2hex (stuff, 20, NULL);
   if (!p)
     fail (0);
-  if (strcmp (p, hexstuff))
+  else if (strcmp (p, hexstuff))
     fail (0);
 
   p = bin2hex (stuff, (size_t)(-1), NULL);
   if (p)
     fail (0);
-  if (errno != ENOMEM)
+  else if (errno != ENOMEM)
     fail (1);
 }
 
@@ -264,13 +264,13 @@ test_bin2hexcolon (void)
   p = bin2hexcolon (stuff, 20, NULL);
   if (!p)
     fail (0);
-  if (strcmp (p, hexstuff))
+  else if (strcmp (p, hexstuff))
     fail (0);
 
   p = bin2hexcolon (stuff, (size_t)(-1), NULL);
   if (p)
     fail (0);
-  if (errno != ENOMEM)
+  else if (errno != ENOMEM)
     fail (1);
 }
 
diff --git a/common/t-mapstrings.c b/common/t-mapstrings.c
index 88c6674..8f4c650 100644
--- a/common/t-mapstrings.c
+++ b/common/t-mapstrings.c
@@ -68,7 +68,7 @@ test_map_static_macro_string (void)
       result = map_static_macro_string (tests[testno].string);
       if (!result)
         fail (testno);
-      if (strcmp (result, tests[testno].expected))
+      else if (strcmp (result, tests[testno].expected))
         fail (testno);
       if (!tests[testno].lastresult)
         tests[testno].lastresult = result;
@@ -80,7 +80,7 @@ test_map_static_macro_string (void)
       result = map_static_macro_string (tests[testno].string);
       if (!result)
         fail (testno);
-      if (strcmp (result, tests[testno].expected))
+      else if (strcmp (result, tests[testno].expected))
         fail (testno);
       if (result != tests[testno].lastresult)
         fail (testno);
diff --git a/common/t-stringhelp.c b/common/t-stringhelp.c
index e97b64a..af79cb5 100644
--- a/common/t-stringhelp.c
+++ b/common/t-stringhelp.c
@@ -143,7 +143,7 @@ test_percent_escape (void)
       result = percent_escape (tests[testno].value, tests[testno].extra);
       if (!result)
         fail (testno);
-      if (strcmp (result, tests[testno].expected))
+      else if (strcmp (result, tests[testno].expected))
         fail (testno);
       xfree (result);
     }
@@ -398,13 +398,13 @@ test_make_filename_try (void)
   out = make_filename_try ("~/foo", "bar", NULL);
   if (!out)
     fail (2);
-  if (home)
+  else if (home)
     {
       if (strlen (out) < homelen + 7)
         fail (2);
-      if (strncmp (out, home, homelen))
+      else if (strncmp (out, home, homelen))
         fail (2);
-      if (strcmp (out+homelen, "/foo/bar"))
+      else if (strcmp (out+homelen, "/foo/bar"))
         fail (2);
     }
   else
@@ -417,13 +417,13 @@ test_make_filename_try (void)
   out = make_filename_try ("~", "bar", NULL);
   if (!out)
     fail (2);
-  if (home)
+  else if (home)
     {
       if (strlen (out) < homelen + 3)
         fail (2);
-      if (strncmp (out, home, homelen))
+      else if (strncmp (out, home, homelen))
         fail (2);
-      if (strcmp (out+homelen, "/bar"))
+      else if (strcmp (out+homelen, "/bar"))
         fail (2);
     }
   else
@@ -445,33 +445,33 @@ test_make_absfilename_try (void)
   out = make_absfilename_try ("foo", "bar", NULL);
   if (!out)
     fail (0);
-  if (strlen (out) < cwdlen + 7)
+  else if (strlen (out) < cwdlen + 7)
     fail (0);
-  if (strncmp (out, cwd, cwdlen))
+  else if (strncmp (out, cwd, cwdlen))
     fail (0);
-  if (strcmp (out+cwdlen, "/foo/bar"))
+  else if (strcmp (out+cwdlen, "/foo/bar"))
     fail (0);
   xfree (out);
 
   out = make_absfilename_try ("./foo", NULL);
   if (!out)
     fail (1);
-  if (strlen (out) < cwdlen + 5)
+  else if (strlen (out) < cwdlen + 5)
     fail (1);
-  if (strncmp (out, cwd, cwdlen))
+  else if (strncmp (out, cwd, cwdlen))
     fail (1);
-  if (strcmp (out+cwdlen, "/./foo"))
+  else if (strcmp (out+cwdlen, "/./foo"))
     fail (1);
   xfree (out);
 
   out = make_absfilename_try (".", NULL);
   if (!out)
     fail (2);
-  if (strlen (out) < cwdlen)
+  else if (strlen (out) < cwdlen)
     fail (2);
-  if (strncmp (out, cwd, cwdlen))
+  else if (strncmp (out, cwd, cwdlen))
     fail (2);
-  if (strcmp (out+cwdlen, ""))
+  else if (strcmp (out+cwdlen, ""))
     fail (2);
   xfree (out);
 
diff --git a/common/t-timestuff.c b/common/t-timestuff.c
index cb7cd39..a80aaff 100644
--- a/common/t-timestuff.c
+++ b/common/t-timestuff.c
@@ -124,25 +124,28 @@ test_timegm (void)
       tp = gmtime (&now);
       if (!tp)
         fail (tidx);
-      tbuf = *tp;
-      tbuf2 = tbuf;
+      else
+        {
+          tbuf = *tp;
+          tbuf2 = tbuf;
 #ifdef HAVE_TIMEGM
-      atime = timegm (&tbuf);
+          atime = timegm (&tbuf);
 #else
-      atime = mktime (&tbuf);
+          atime = mktime (&tbuf);
 #endif
-      if (atime == (time_t)(-1))
-        fail (tidx);
-      if (atime != now)
-        fail (tidx);
-
-      tp = gmtime (&atime);
-      if (!tp)
-        fail (tidx);
-      if (cmp_time_s (tp, &tbuf))
-        fail (tidx);
-      if (cmp_time_s (tp, &tbuf2))
-        fail (tidx);
+          if (atime == (time_t)(-1))
+            fail (tidx);
+          else if (atime != now)
+            fail (tidx);
+
+          tp = gmtime (&atime);
+          if (!tp)
+            fail (tidx);
+          else if (cmp_time_s (tp, &tbuf))
+            fail (tidx);
+          else if (cmp_time_s (tp, &tbuf2))
+            fail (tidx);
+        }
     }
 }
 

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

Summary of changes:
 common/b64enc.c               |  2 --
 common/iobuf.c                |  1 -
 common/t-convert.c            |  8 ++++----
 common/t-mapstrings.c         |  4 ++--
 common/t-stringhelp.c         | 32 ++++++++++++++++----------------
 common/t-timestuff.c          | 35 +++++++++++++++++++----------------
 common/tlv.c                  |  1 -
 common/userids.c              |  1 -
 dirmngr/t-dns-stuff.c         |  6 ++++--
 g10/encrypt.c                 |  1 +
 g10/keyedit.c                 | 20 +++++++++++++++++---
 g10/parse-packet.c            |  9 +++++++--
 g10/sign.c                    |  1 +
 g10/test.c                    | 11 ++++++-----
 kbx/keybox-openpgp.c          |  1 -
 kbx/keybox-update.c           |  3 +--
 tests/openpgp/4gb-packet.test |  6 ++----
 17 files changed, 80 insertions(+), 62 deletions(-)


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




More information about the Gnupg-commits mailing list