And of course, I noticed this email after sending my own... sorry. In message <CALiegf=BytJ-1ZDzcCw3=e2=6moritr87pjunro4cxorysy...@mail.gmail.com> on Mon, 8 Sep 2014 18:41:40 +0200, Iñaki Baz Castillo <i...@aliax.net> said:
ibc> 2014-09-08 18:35 GMT+02:00 Kyle Hamilton <aerow...@gmail.com>: ibc> > The allocated buffer needs to be sizeof(char *). What's happening is the ibc> > address of the buffer (&buffer[0]) gets written to the ibc> > pointer-to-pointer-to-char, data. If data == NULL, you're asking to write ibc> > the address of the buffer to unallocated memory. ibc> > ibc> > It's done this way because the return value of the function is the number of ibc> > valid bytes you can read from that location, and the address must go ibc> > somewhere for you to get the data from it. ibc> > ibc> > I'm sorry this is probably difficult to understand, I don't know if I can ibc> > explain it more easily. ibc> ibc> It's clear. And my error was terrible, I was creating a char** data ibc> instead of char* data. The following updated code does work: ibc> ibc> ibc> ------------------------------------- ibc> long read; ibc> char* data = NULL; ibc> ibc> read = BIO_get_mem_data(bio, &data); ibc> ibc> // Use data and read values. ibc> ------------------------------------- ibc> ibc> ibc> Thanks a lot. ibc> ibc> ibc> -- ibc> Iñaki Baz Castillo ibc> <i...@aliax.net> ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org