15 Star 6 Fork 58

src-openEuler/edk2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0023-PATCH-Avoid-dangling-ptrs-in-header-and-data-params-.patch 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
shaodenghui 提交于 2023-02-25 18:27 +08:00 . fix CVE-2023-0401
From a114dc3c9af48a8f8ed22e738944a9c3e830a088 Mon Sep 17 00:00:00 2001
From Shao Denghui <[email protected]>
Date: Mon, 20 Feb 2023 21:59:31 +0800
Subject: [PATCH] [PATCH] Avoid dangling ptrs in header and data params for
PEM_read_bio_ex In the event of a failure in PEM_read_bio_ex() we free the
buffers we allocated for the header and data buffers. However we were not
clearing the ptrs stored in *header and *data. Since, on success, the caller
is responsible for freeing these ptrs this can potentially lead to a double
free if the caller frees them even on failure.
Thanks to Dawei Wang for reporting this issue.
Based on a proposed patch by Kurt Roeckx.
CVE-2022-4450
Reference: https://github.com/openssl/openssl/commit/ee6243f3947107d655f6dee96f63861561a5aaeb
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
Signed-off-by: Shao Denghui <[email protected]>
---
CryptoPkg/Library/OpensslLib/openssl/crypto/pem/pem_lib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/pem/pem_lib.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/pem/pem_lib.c
index 64baf71..6c7c4fe 100644
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/pem/pem_lib.c
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/pem/pem_lib.c
@@ -940,7 +940,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);
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/edk2.git
[email protected]:src-openeuler/edk2.git
src-openeuler
edk2
edk2
openEuler-24.03-LTS-update-before-20241025

搜索帮助