[svn] ksba - r243 - in trunk: . src

svn author wk cvs at cvs.gnupg.org
Mon Jun 19 10:25:10 CEST 2006


Author: wk
Date: 2006-06-19 10:25:08 +0200 (Mon, 19 Jun 2006)
New Revision: 243

Modified:
   trunk/NEWS
   trunk/src/ChangeLog
   trunk/src/ber-decoder.c
Log:
Fixed BER parser


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2006-06-08 00:43:48 UTC (rev 242)
+++ trunk/NEWS	2006-06-19 08:25:08 UTC (rev 243)
@@ -1,7 +1,9 @@
 Noteworthy changes in version 0.9.15
 -------------------------------------------------
 
+ * Fixed BER parser which was broken in the last release.
 
+
 Noteworthy changes in version 0.9.14 (2006-05-16)
 -------------------------------------------------
 

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2006-06-08 00:43:48 UTC (rev 242)
+++ trunk/src/ChangeLog	2006-06-19 08:25:08 UTC (rev 243)
@@ -1,3 +1,10 @@
+2006-06-19  Werner Koch  <wk at g10code.com>
+
+	* ber-decoder.c (_ksba_ber_decoder_decode): always store value
+	even if NODE is NULL.  It used to work only because NODE used to
+	be unitialized and thus most of the time yielded true.  The
+	2006-05-03 fix unveiled the actual problem.
+
 2006-06-08  Marcus Brinkmann  <marcus at g10code.de>
 
 	* cert.c (ksba_cert_get_crl_dist_point): Fix type of R_REASON.

Modified: trunk/src/ber-decoder.c
===================================================================
--- trunk/src/ber-decoder.c	2006-06-08 00:43:48 UTC (rev 242)
+++ trunk/src/ber-decoder.c	2006-06-19 08:25:08 UTC (rev 243)
@@ -1,5 +1,5 @@
 /* ber-decoder.c - Basic Encoding Rules Decoder
- *      Copyright (C) 2001, 2004 g10 Code GmbH
+ *      Copyright (C) 2001, 2004, 2006 g10 Code GmbH
  *
  * This file is part of KSBA.
  *
@@ -812,8 +812,8 @@
     {
       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 */
+          /* We need some extra bytes to store the stuff we read ahead
+             at the end of the module which is later pushed back. */
           d->image.length = ti.length + 100;
           d->image.used = 0;
           d->image.buf = xtrymalloc (d->image.length);
@@ -823,6 +823,7 @@
 
       if (ti.nhdr + d->image.used >= d->image.length)
         return set_error (d, NULL, "image buffer too short to store the tag");
+
       memcpy (d->image.buf + d->image.used, ti.buf, ti.nhdr);
       d->image.used += ti.nhdr;
     }
@@ -1138,9 +1139,12 @@
       int n, c;
 
       node = d->val.node;
-      if (node && d->use_image)
+      /* Fixme: USE_IMAGE is only not used with the ber-dump utility
+         and thus of no big use.  We should remove the other code
+         paths and dump ber-dump.c. */
+      if (d->use_image)
         {
-          if (!d->val.is_endtag)
+          if (node && !d->val.is_endtag)
             { /* We don't have nodes for the end tag - so don't store it */
               node->off = (ksba_reader_tell (d->reader)
                            - d->val.nhdr - startoff);




More information about the Gnupg-commits mailing list