9 Star 0 Fork 19

src-openEuler/libssh2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Prevent-possible-double-free-of-hostkey.patch 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
bitianyuan 提交于 2024-11-06 15:51 . backport some upstream patches
From b3465418471ffa4cf0bbe1e8f28c4d007f060f99 Mon Sep 17 00:00:00 2001
From: Will Cosgrove <[email protected]>
Date: Tue, 10 Sep 2024 09:35:26 -0700
Subject: [PATCH] Prevent possible double free of hostkey (#1452)
NULL server hostkey based on fuzzer failure case.
Conflict:NA
Reference:https://github.com/libssh2/libssh2/commit/b3465418471ffa4cf0bbe1e8f28c4d007f060f99
---
src/kex.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/kex.c b/src/kex.c
index 5f381ec..7053316 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -379,8 +379,11 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session,
buf.dataptr = buf.data;
buf.dataptr++; /* advance past type */
- if(session->server_hostkey)
+ if(session->server_hostkey) {
LIBSSH2_FREE(session, session->server_hostkey);
+ session->server_hostkey = NULL;
+ session->server_hostkey_len = 0;
+ }
if(_libssh2_copy_string(session, &buf, &(session->server_hostkey),
&host_key_len)) {
--
2.43.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libssh2.git
[email protected]:src-openeuler/libssh2.git
src-openeuler
libssh2
libssh2
master

搜索帮助