--- bn_asm.c.orig	2012-12-16 16:54:36.209532523 -0800
+++ bn_asm.c	2012-12-16 17:00:25.284555278 -0800
@@ -857,6 +857,8 @@
 	if (ap==bp)	return bn_sqr_mont(rp,ap,np,n0p,num);
 #endif
 	vp = tp = alloca((num+2)*sizeof(BN_ULONG));
+        if (tp == NULL) /* if NULL, insufficient stack space available */
+                return 1; /* Should we just return here, or is more needed? */
 
 	n0 = *n0p;
 
@@ -990,6 +992,8 @@
 	int i=0,j;
 
 	vp = tp = alloca((num+2)*sizeof(BN_ULONG));
+        if (tp == NULL) /* if NULL, insufficient stack space available */
+                return 1; /* Should we just return here, or is more needed? */
 
 	for(i=0;i<=num;i++)	tp[i]=0;
 
