[svn] GnuPG - r4426 - trunk/g10
svn author wk
cvs at cvs.gnupg.org
Sun Feb 4 18:23:02 CET 2007
Author: wk
Date: 2007-02-04 18:23:00 +0100 (Sun, 04 Feb 2007)
New Revision: 4426
Modified:
trunk/g10/ChangeLog
trunk/g10/parse-packet.c
Log:
Fix for Debian bug 402592
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2007-02-04 17:20:24 UTC (rev 4425)
+++ trunk/g10/ChangeLog 2007-02-04 17:23:00 UTC (rev 4426)
@@ -1,3 +1,8 @@
+2007-02-04 Werner Koch <wk at g10code.com>
+
+ * parse-packet.c (parse_signature): Limit bytes read for an
+ unknown alogorithm. Fixes Debian bug#402592.
+
2007-01-31 Werner Koch <wk at g10code.com>
* verify.c (verify_signatures): Do no dereference a NULL afx.
Modified: trunk/g10/parse-packet.c
===================================================================
--- trunk/g10/parse-packet.c 2007-02-04 17:20:24 UTC (rev 4425)
+++ trunk/g10/parse-packet.c 2007-02-04 17:23:00 UTC (rev 4426)
@@ -1494,9 +1494,19 @@
unknown_pubkey_warning( sig->pubkey_algo );
/* We store the plain material in data[0], so that we are able
* to write it back with build_packet() */
- sig->data[0]= gcry_mpi_set_opaque (NULL, read_rest(inp, pktlen, 0),
- pktlen*8 );
- pktlen = 0;
+ if (pktlen > (5 * MAX_EXTERN_MPI_BITS/8))
+ {
+ /* However we include a limit to avoid too trivial DoS
+ attacks by having gpg allocate too much memory. */
+ log_error ("signature packet: too much data\n");
+ rc = G10ERR_INVALID_PACKET;
+ }
+ else
+ {
+ sig->data[0]= gcry_mpi_set_opaque (NULL, read_rest(inp, pktlen, 0),
+ pktlen*8 );
+ pktlen = 0;
+ }
}
else {
for( i=0; i < ndata; i++ ) {
More information about the Gnupg-commits
mailing list