BIO_new_mem_buf with negative len should take strlen of buf as len
This commit is contained in:
parent
4a85bf8108
commit
5f7832909b
@ -14913,7 +14913,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||
{
|
||||
WOLFSSL_BIO* bio = NULL;
|
||||
|
||||
if (buf == NULL || len < 0) {
|
||||
if (buf == NULL) {
|
||||
return bio;
|
||||
}
|
||||
|
||||
@ -14922,6 +14922,9 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||
return bio;
|
||||
}
|
||||
|
||||
if (len < 0) {
|
||||
len = XSTRLEN(buf);
|
||||
}
|
||||
bio->num = bio->wrSz = len;
|
||||
bio->ptr = (byte*)XMALLOC(len, 0, DYNAMIC_TYPE_OPENSSL);
|
||||
if (bio->ptr == NULL) {
|
||||
|
@ -24983,10 +24983,9 @@ static void test_wolfSSL_BIO_gets(void)
|
||||
|
||||
/* try with bad args */
|
||||
AssertNull(bio = BIO_new_mem_buf(NULL, sizeof(msg)));
|
||||
AssertNull(bio = BIO_new_mem_buf((void*)msg, -1));
|
||||
|
||||
/* try with real msg */
|
||||
AssertNotNull(bio = BIO_new_mem_buf((void*)msg, sizeof(msg)));
|
||||
AssertNotNull(bio = BIO_new_mem_buf((void*)msg, -1));
|
||||
XMEMSET(bio_buffer, 0, bufferSz);
|
||||
AssertNotNull(BIO_push(bio, BIO_new(BIO_s_bio())));
|
||||
AssertNull(bio2 = BIO_find_type(bio, BIO_TYPE_FILE));
|
||||
|
Loading…
x
Reference in New Issue
Block a user