[git] KSBA - branch, master, updated. libksba-1.3.4-2-g2a9fc56

by Werner Koch cvs at cvs.gnupg.org
Wed May 11 12:41:43 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 "KSBA is a library to access X.509 certificates and CMS data.".

The branch, master has been updated
       via  2a9fc5654df497b91ab9b64e946c1e19371888e5 (commit)
      from  ba090d96be474658dec13a3e2aa912022a3ef72f (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 2a9fc5654df497b91ab9b64e946c1e19371888e5
Author: Werner Koch <wk at gnupg.org>
Date:   Wed May 11 12:40:12 2016 +0200

    Make sure that ASN.1 data is stored in an all-initialized buffer.
    
    * src/ber-decoder.c (decoder_next): Clear the image buffer.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/ber-decoder.c b/src/ber-decoder.c
index 9e70d92..dde73fd 100644
--- a/src/ber-decoder.c
+++ b/src/ber-decoder.c
@@ -857,12 +857,17 @@ decoder_next (BerDecoder d)
       if (!d->image.buf)
         {
           /* We need some extra bytes to store the stuff we read ahead
-             at the end of the module which is later pushed back. */
+           * at the end of the module which is later pushed back.  We
+           * also clear the buffer because there is no guarantee that
+           * we will copy data to all bytes of the buffer: A broken
+           * ASN.1 encoding may thus lead to access of uninitialized
+           * data even if we make sure that that access is not our of
+           * bounds. */
           d->image.used = 0;
           d->image.length = ti.length + 100;
           if (d->image.length < ti.length)
             return gpg_error (GPG_ERR_BAD_BER);
-          d->image.buf = xtrymalloc (d->image.length);
+          d->image.buf = xtrycalloc (1, d->image.length);
           if (!d->image.buf)
             return gpg_error (GPG_ERR_ENOMEM);
         }
@@ -1133,7 +1138,7 @@ _ksba_ber_decoder_dump (BerDecoder d, FILE *fp)
               p = ksba_oid_to_str (buf, n);
               break;
             default:
-              for (i=0; i < n && i < 20; i++)
+              for (i=0; i < n && (d->debug || i < 20); i++)
                 fprintf (fp,"%02x", buf[i]);
               if (i < n)
                 fputs ("..more..", fp);

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

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


hooks/post-receive
-- 
KSBA is a library to access X.509 certificates and CMS data.
http://git.gnupg.org




More information about the Gnupg-commits mailing list