Hi,

On Tue, 2004-09-28 at 03:08, Leonard den Ottolander wrote:
> It appears the definition of OpenSSLDie in cryptlib.c in the
> openssl-engine-0.9.6.m is redundant. die() is no longer used in this
> version. It is substituted with if blocks instead. These are replaced
> with OPENSSL_asserts in 0.9.7.

die() should be used in ssl_asn1.c (unless another construct is
introduced that handles os.length <= sizeof ret->session_id).

See attached patch. Also applies against
openssl-e-0.9.6-stable-SNAP-20040926.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research

--- crypto/cryptlib.h.000	2004-01-29 10:42:44.000000000 +0100
+++ crypto/cryptlib.h	2004-09-28 17:02:19.000000000 +0200
@@ -97,6 +97,10 @@ extern "C" {
 #define DECIMAL_SIZE(type)     ((sizeof(type)*8+2)/3+1)
 #define HEX_SIZE(type)         ((sizeof(type)*2)
 
+/* die if we have to */
+void OpenSSLDie(const char *file,int line,const char *assertion);
+#define die(e)	((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e))
+
 #ifdef  __cplusplus
 }
 #endif
--- ssl/ssl_asn1.c.000	2002-08-02 13:37:36.000000000 +0200
+++ ssl/ssl_asn1.c	2004-09-28 17:06:19.000000000 +0200
@@ -278,6 +278,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION
 		os.length = sizeof ret->session_id;
 
 	ret->session_id_length=os.length;
+	die(os.length <= sizeof ret->session_id);
 	memcpy(ret->session_id,os.data,os.length);
 
 	M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING);

Reply via email to