未验证 提交 416f6af1 编写于 作者: O openharmony_ci 提交者: Gitee

!81 OpenHarmony lts3.0修复openssl漏洞CVE-2022-4450

Merge pull request !81 from wanghao-free/OpenHarmony-3.0-LTS
......@@ -954,7 +954,9 @@ int PEM_read_bio_ex(BIO *bp, char **name_out, char **header,
*data = pem_malloc(len, flags);
if (*header == NULL || *data == NULL) {
pem_free(*header, flags, 0);
*header = NULL;
pem_free(*data, flags, 0);
*data = NULL;
goto end;
}
BIO_read(headerB, *header, headerlen);
......
......@@ -83,9 +83,39 @@ static int test_invalid(void)
return 1;
}
static int test_empty_payload(void)
{
BIO *b;
static char *emptypay =
"-----BEGIN CERTIFICATE-----\n"
"-\n" /* Base64 EOF character */
"-----END CERTIFICATE-----";
char *name = NULL, *header = NULL;
unsigned char *data = NULL;
long len;
int ret = 0;
b = BIO_new_mem_buf(emptypay, strlen(emptypay));
if (!TEST_ptr(b))
return 0;
/* Expected to fail because the payload is empty */
if (!TEST_false(PEM_read_bio_ex(b, &name, &header, &data, &len, 0)))
goto err;
ret = 1;
err:
OPENSSL_free(name);
OPENSSL_free(header);
OPENSSL_free(data);
BIO_free(b);
return ret;
}
int setup_tests(void)
{
ADD_ALL_TESTS(test_b64, OSSL_NELEM(b64_pem_data));
ADD_TEST(test_invalid);
ADD_TEST(test_empty_payload);
return 1;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册