--- bn_exp.c.orig	2012-12-16 16:47:56.863559052 -0800
+++ bn_exp.c	2012-12-16 16:49:05.213512656 -0800
@@ -634,6 +634,7 @@
 #ifdef alloca
 	if (powerbufLen < 3072)
 		powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
+                if (powerbufFree == NULL) goto err; /* if NULL, not enough memory on stack */
 	else
 #endif
 	if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
