bug fix

Remi Guyomarch rguyom at mail.dotcom.fr
Sun Jun 6 21:08:26 CEST 1999


Oops, I introduced a bug in my speed-patches. In g10/free-packet.c,
free_encrypted() and free_plaintext() won't detect the end of the
packet if the buffer has already been read. Here's a patch :

Index: free-packet.c
===================================================================
RCS file: /home/koch/cvs/gnupg/g10/free-packet.c,v
retrieving revision 1.31
diff -u -r1.31 free-packet.c
--- free-packet.c       1999/05/31 17:49:29     1.31
+++ free-packet.c       1999/06/06 14:19:52
@@ -244,8 +244,13 @@
                ;
        }
        else {
-           while( ed->len ) /* skip the packet */
-               ed->len -= iobuf_read( ed->buf, NULL, ed->len );
+           while( ed->len ) { /* skip the packet */
+               int n = iobuf_read( ed->buf, NULL, ed->len );
+               if( n == -1 )
+                   ed->len = 0;
+               else
+                   ed->len -= n;
+           }
        }
     }
     m_free(ed);
@@ -261,8 +266,13 @@
                ;
        }
        else {
-           while( pt->len ) /* skip the packet */
-               pt->len -= iobuf_read( pt->buf, NULL, pt->len );
+           while( pt->len ) { /* skip the packet */
+               int n = iobuf_read( pt->buf, NULL, pt->len );
+               if( n == -1 )
+                   pt->len = 0;
+               else
+                   pt->len -= n;
+           }
        }
     }
     m_free(pt);


-- 
Rémi        <rguyom at mail.dotcom.fr> | Don't waste your computer's time :
    PGP-encrypt anything important: | http://www.distributed.net/
   www.gnupg.org - KeyID:0x85BD8B1B | http://www.distributed.net/source/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 241 bytes
Desc: not available
Url : /pipermail/attachments/19990606/a519111a/attachment.bin


More information about the Gnupg-devel mailing list