2014-09-08 16:08 GMT+02:00 Richard Levitte <rich...@levitte.org>: > Sorry, BIO_flush() isn't what you want (it doesn't reset the buffer to > empty), BIO_reset() is. > > However, you need to be careful... if I were you, I would use the > read data before resetting, as BIO_get_mem_data() gives you the > pointer to the internal BIO_s_mem buffer, not to a duplicate of it.
Thanks, it does work. However... I do not understand how... This works fine: ----------------------------------- long read; // myBuffer is an already allocated buffer. char** data = (char**)&myBuffer; read = BIO_get_mem_data(bio, data); // Use data and read values. BIO_reset(bio); ----------------------------------- This crashes: ----------------------------------- long read; char** data = NULL; read = BIO_get_mem_data(bio, data); // Use data and read values. BIO_reset(bio); ----------------------------------- Why do I need to provide BIO_get_mem_data() with an already allocated buffer? I've checked the function and I do not understand what it does). The only I want is to get the pointer to the BIO's buffer in which SSL_write() wrote. Why should I provide an allocated buffer? The BIO already has a buffer and the data is already in there after calling SSL_write(). Why do I need to pass an allocated buffer? 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