From: ben Date: Wed, 19 Jan 2005 23:30:38 +0000 (+0000) Subject: Add an assertion so that short-rsa2-key-crash at least avoids segfaulting X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/e99cd73fed21152a2cea8d43cd76d33eda408b08 Add an assertion so that short-rsa2-key-crash at least avoids segfaulting while we come up with a better solution. git-svn-id: svn://svn.tartarus.org/sgt/putty@5146 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/sshrsa.c b/sshrsa.c index baec83e0..4f95fb38 100644 --- a/sshrsa.c +++ b/sshrsa.c @@ -802,6 +802,7 @@ static unsigned char *rsa2_sign(void *key, char *data, int datalen, SHA_Simple(data, datalen, hash); nbytes = (bignum_bitcount(rsa->modulus) - 1) / 8; + assert(1 <= nbytes - 20 - ASN1_LEN); bytes = snewn(nbytes, unsigned char); bytes[0] = 1;