[git] GnuPG - branch, master, updated. gnupg-2.1.17-26-g5b6ebfb

by Werner Koch cvs at cvs.gnupg.org
Mon Jan 2 13:34:06 CET 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  5b6ebfb9244602d9de31d61c7eceb0c45ac8aa49 (commit)
       via  6b84ecbf312d98ac8cce9fe5facdc815bc742fa1 (commit)
       via  c52930d11fcc52515fcc09a1085bf118411566a8 (commit)
      from  b0e14bd6ff8401b12b2b39f75aef94d3ad28017f (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 5b6ebfb9244602d9de31d61c7eceb0c45ac8aa49
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Jan 2 13:30:37 2017 +0100

    g13: Improve printing of debug infos.
    
    * g13/g13tuple.c (all_printable): Make it work.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g13/g13tuple.c b/g13/g13tuple.c
index f79c82d..b10ebbc 100644
--- a/g13/g13tuple.c
+++ b/g13/g13tuple.c
@@ -282,7 +282,7 @@ all_printable (const void *buf, size_t buflen)
   const unsigned char *s;
 
   for (s=buf ; buflen; s++, buflen--)
-    if (*s < 32 && *s > 126)
+    if (*s < 32 || *s > 126)
       return 0;
   return 1;
 }

commit 6b84ecbf312d98ac8cce9fe5facdc815bc742fa1
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Jan 2 13:29:18 2017 +0100

    Replace use of variable-length-arrays.
    
    * common/t-iobuf.c (main): Replace variable-length-array.
    * g10/gpgcompose.c (mksubpkt_callback): Ditto.
    (encrypted): Ditto.
    * g10/t-stutter.c (log_hexdump): Ditto.
    (oracle_test): Ditto.
    * g10/tofu.c (get_policy): Ditto.  Use "%zu" for size_t.
    * scd/app-openpgp.c (ecc_writekey): Replace variable-length-array.
    Check for zero length OID_LEN.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/t-iobuf.c b/common/t-iobuf.c
index 0e6f508..bdeab99 100644
--- a/common/t-iobuf.c
+++ b/common/t-iobuf.c
@@ -362,10 +362,12 @@ main (int argc, char *argv[])
   {
     iobuf_t iobuf;
     int rc;
-    char *content = "0123456789";
+    char content[] = "0123456789";
     int n;
     int c;
-    char buffer[strlen (content)];
+    char buffer[10];
+
+    assert (sizeof buffer == sizeof content - 1);
 
     iobuf = iobuf_temp_with_content (content, strlen (content));
     assert (iobuf);
diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c
index 512cb45..fafbfd2 100644
--- a/g10/gpgcompose.c
+++ b/g10/gpgcompose.c
@@ -1654,13 +1654,17 @@ mksubpkt_callback (PKT_signature *sig, void *cookie)
 
   if (si->reason_for_revocation)
     {
-      int l = 1 + strlen (si->reason_for_revocation);
-      char buf[l];
+      int len = 1 + strlen (si->reason_for_revocation);
+      char *buf;
+
+      buf = xmalloc (len);
 
       buf[0] = si->reason_for_revocation_code;
-      memcpy (&buf[1], si->reason_for_revocation, l - 1);
+      memcpy (&buf[1], si->reason_for_revocation, len - 1);
+
+      build_sig_subpkt (sig, SIGSUBPKT_REVOC_REASON, buf, len);
 
-      build_sig_subpkt (sig, SIGSUBPKT_REVOC_REASON, buf, l);
+      xfree (buf);
     }
 
   if (si->features)
@@ -2540,10 +2544,13 @@ encrypted (const char *option, int argc, char *argv[], void *cookie)
 
   if (do_debug)
     {
-      char buf[2 * session_key.keylen + 1];
+      char *buf;
+
+      buf = xmalloc (2 * session_key.keylen + 1);
       debug ("session key: algo: %d; keylen: %d; key: %s\n",
              session_key.algo, session_key.keylen,
              bin2hex (session_key.key, session_key.keylen, buf));
+      xfree (buf);
     }
 
   if (strcmp (option, "--encrypted-mdc") == 0)
diff --git a/g10/t-stutter.c b/g10/t-stutter.c
index a2e9666..359cdf6 100644
--- a/g10/t-stutter.c
+++ b/g10/t-stutter.c
@@ -68,8 +68,8 @@ log_hexdump (byte *buffer, int length)
     {
       int have = length > 16 ? 16 : length;
       int i;
-      char formatted[2 * have + 1];
-      char text[have + 1];
+      char formatted[2 * 16 + 1];
+      char text[16 + 1];
 
       fprintf (stderr, "%-8d ", written);
       bin2hex (buffer, have, formatted);
@@ -87,10 +87,12 @@ log_hexdump (byte *buffer, int length)
         }
 
       for (i = 0; i < have; i ++)
-        if (isprint (buffer[i]))
-          text[i] = buffer[i];
-        else
-          text[i] = '.';
+        {
+          if (isprint (buffer[i]))
+            text[i] = buffer[i];
+          else
+            text[i] = '.';
+        }
       text[i] = 0;
 
       fprintf (stderr, "    ");
@@ -347,8 +349,9 @@ oracle (int debug, byte *ciphertext, int len, byte **plaintextp, byte **cfbp)
 static int
 oracle_test (unsigned int d, int b, int debug)
 {
-  byte probe[blocksize + 2];
+  byte probe[32 + 2];
 
+  log_assert (blocksize + 2 <= sizeof probe);
   log_assert (d < 256 * 256);
 
   if (b == 1)
diff --git a/g10/tofu.c b/g10/tofu.c
index 2bded9e..8d535fa 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -2457,16 +2457,16 @@ get_policy (tofu_dbs_t dbs, PKT_public_key *pk,
   /* See if the key is signed by an ultimately trusted key.  */
   {
     int fingerprint_raw_len = strlen (fingerprint) / 2;
-    char fingerprint_raw[fingerprint_raw_len];
+    char fingerprint_raw[20];
     int len = 0;
 
-    if (fingerprint_raw_len != 20
+    if (fingerprint_raw_len != sizeof fingerprint_raw
         || ((len = hex2bin (fingerprint,
                             fingerprint_raw, fingerprint_raw_len))
             != strlen (fingerprint)))
       {
         if (DBG_TRUST)
-          log_debug ("TOFU: Bad fingerprint: %s (len: %zd, parsed: %d)\n",
+          log_debug ("TOFU: Bad fingerprint: %s (len: %zu, parsed: %d)\n",
                      fingerprint, strlen (fingerprint), len);
       }
     else
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 5fa4fd2..4d8b1bc 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -3580,11 +3580,23 @@ ecc_writekey (app_t app, gpg_error_t (*pincb)(void*, const char *, char **),
     {
       if (app->app_local->extcap.algo_attr_change)
         {
-          unsigned char keyattr[oid_len];
+          unsigned char *keyattr;
 
+          if (!oid_len)
+            {
+              err = gpg_error (GPG_ERR_INTERNAL);
+              goto leave;
+            }
+          keyattr = xtrymalloc (oid_len);
+          if (!keyattr)
+            {
+              err = gpg_error_from_syserror ();
+              goto leave;
+            }
           keyattr[0] = algo;
           memcpy (keyattr+1, oidbuf+1, oid_len-1);
           err = change_keyattr (app, keyno, keyattr, oid_len, pincb, pincb_arg);
+          xfree (keyattr);
           if (err)
             goto leave;
         }

commit c52930d11fcc52515fcc09a1085bf118411566a8
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Jan 2 12:59:10 2017 +0100

    build: Enable gcc warnings to detect non-portable code.
    
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/configure.ac b/configure.ac
index 80d977c..fa206c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1574,6 +1574,15 @@ if test "$GCC" = yes; then
         if test x"$_gcc_wopt" = xyes ; then
           mycflags="$mycflags -Wdeclaration-after-statement"
         fi
+
+        AC_MSG_CHECKING([if gcc supports -Wlogical-op and -Wvla])
+        CFLAGS="-Wlogical-op -Wvla"
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
+        AC_MSG_RESULT($_gcc_wopt)
+        if test x"$_gcc_wopt" = xyes ; then
+          mycflags="$mycflags -Wlogical-op -Wvla"
+        fi
+
     else
         mycflags="$mycflags -Wall"
     fi

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

Summary of changes:
 common/t-iobuf.c  |  6 ++++--
 configure.ac      |  9 +++++++++
 g10/gpgcompose.c  | 17 ++++++++++++-----
 g10/t-stutter.c   | 17 ++++++++++-------
 g10/tofu.c        |  6 +++---
 g13/g13tuple.c    |  2 +-
 scd/app-openpgp.c | 14 +++++++++++++-
 7 files changed, 52 insertions(+), 19 deletions(-)


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




More information about the Gnupg-commits mailing list