libssh2/backport-We-should-check-whether-key_method-is-a-NULL-pointer.patch
bitianyuan 9f753913aa backport some upstream patches
(cherry picked from commit 51fdb9be6c5591c0f02dbed57496dedbdcb12f3d)
2024-11-18 14:29:07 +08:00

31 lines
957 B
Diff

From bec57c409d40822a23f03d2136f33b75b01b4b58 Mon Sep 17 00:00:00 2001
From: renmingshuai <renmingshuai@huawei.com>
Date: Sat, 1 Jul 2023 10:14:48 +0800
Subject: [PATCH] We should check whether *key_method is a NULL pointer instead
of key_method
Signed-off-by: renmingshuai <renmingshuai@huawei.com>
Reference:https://github.com/libssh2/libssh2/commit/bec57c409d40822a23f03d2136f33b75b01b4b58
Conflict:NA
---
src/userauth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/userauth.c b/src/userauth.c
index e7578759..5ce4ccb1 100644
--- a/src/userauth.c
+++ b/src/userauth.c
@@ -1410,7 +1410,7 @@ _libssh2_key_sign_algorithm(LIBSSH2_SESSION *session,
LIBSSH2_FREE(session, *key_method);
*key_method = LIBSSH2_ALLOC(session, match_len);
- if(key_method) {
+ if(*key_method) {
memcpy(*key_method, match, match_len);
*key_method_len = match_len;
}
--
2.27.0