2014-09-08 18:35 GMT+02:00 Kyle Hamilton <aerow...@gmail.com>:
> The allocated buffer needs to be sizeof(char *). What's happening is the
> address of the buffer (&buffer[0]) gets written to the
> pointer-to-pointer-to-char, data. If data == NULL, you're asking to write
> the address of the buffer to unallocated memory.
>
> It's done this way because the return value of the function is the number of
> valid bytes you can read from that location, and the address must go
> somewhere for you to get the data from it.
>
> I'm sorry this is probably difficult to understand, I don't know if I can
> explain it more easily.

It's clear. And my error was terrible, I was creating a char** data
instead of char* data. The following updated code does work:


-------------------------------------
long read;
char* data = NULL;

read = BIO_get_mem_data(bio, &data);

// Use data and read values.
-------------------------------------


Thanks a lot.


-- 
Iñaki Baz Castillo
<i...@aliax.net>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to