Try something like:

unsigned char **msg_aux;

*msg_aux=(unsigned char *) malloc (8194);  /*enough size...*/
 i=i2d_PKCS7(p7,&msg_aux);

Or, if you do want to know the size before allocating:
unsigned char **msg_aux;
int sz;

sz = i2d_PKCS7(p7,NULL);

*msg_aux=(unsigned char *) malloc (sz);  /*enough size! */
 i=i2d_PKCS7(p7,&msg_aux);


--Patrik


Ignacio Gil wrote:

> Hello,
>  I need to transform a PKCS7* to a char* or similar, and I've done this:
>
>  unsigned char **msg_aux;
>  msg_aux=(unsigned char **) malloc (8194);  /*enough size...*/
>  i=i2d_PKCS7(p7,msg_aux);
>
> I've got a segmentation fault.
> Could anybody help me?
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to