在2009-05-28,"Victor Duchovni" <victor.ducho...@morganstanley.com> 写道:
>On Thu, May 28, 2009 at 11:51:42AM +0200, Ger Hobbelt wrote:
>
>> This is a classic/basic 'C' programming mistake you made, not an OpenSSL one:
>>
>> pointers are not arrays are not strings ;-)
>>
>> sizeof(buf) == ?
>>
>> buf is of type 'char *' and therefore sizeof(buf) == sizeof(char *)
>> which is probably 4 or 8, depending on what platform you build this
>> for.
>> If you wish to provide the length of the C string data, pointed at by
>> pointer 'buf', then strlen() is your man:
>>
>> either
>>
>> BIO_puts(b, buf) -- which does this internally
>>
>> or
>>
>> BIO_write(b, buf, strlen(buf))
>
>Only if the data is text. Using strlen() on binary data is another
>classic/basic 'C' programming mistake.
if it is binary data, what to do ? Use a Variable to send the the size ?
>
>--
> Viktor.
>______________________________________________________________________
>OpenSSL Project http://www.openssl.org
>User Support Mailing List openssl-users@openssl.org
>Automated List Manager majord...@openssl.org