On Mon, Feb 02, 2015, Gayathri Manoj wrote: > Hi Steve, > > unsigned char *ptr, *tmp=NULL; > X509_SIG sig; > .... > len=i2d_X509_SIG(sig,NULL); > tmp = (unsigned char*) malloc(513); > ptr=tmp; > i2d_X509_SIG(&sig, &ptr); // here causing problem. > Well you should really malloc 'len' bytes as it could theoretically exceed 513 (in practice it's unlikely). How are you setting up "sig"? Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org