In message <CALiegfmvaG-nc=putyxey20otoiow6op+lajohnoqxf86aw...@mail.gmail.com> 
on Mon, 8 Sep 2014 18:19:09 +0200, Iñaki Baz Castillo <i...@aliax.net> said:

ibc> Why do I need to provide BIO_get_mem_data() with an already allocated
ibc> buffer? I've checked the function and I do not understand what it
ibc> does). The only I want is to get the pointer to the BIO's buffer in
ibc> which SSL_write() wrote. Why should I provide an allocated buffer? The
ibc> BIO already has a buffer and the data is already in there after
ibc> calling SSL_write(). Why do I need to pass an allocated buffer?

Actually, you don't, you only need to pass it the address to a char*
(that's what a char** is).  This code snippet (which is your code
snippet that crashes with a small change) is sufficient:

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

read = BIO_get_mem_data(bio, &data);

// Use data and read values.

BIO_reset(bio);
------------------------------

Cheers,
Richard

-- 
Richard Levitte                         rich...@levitte.org
                                        http://richard.levitte.org/

"Life is a tremendous celebration - and I'm invited!"
-- from a friend's blog, translated from Swedish
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to