libssh2/backport-Fix-a-memcmp-errors-in-code-that-was-changed-from-me.patch
2023-03-28 19:46:08 +08:00

42 lines
1.4 KiB
Diff

From 13ad7b2f5cd67e0dc843098ce19ce8b208368c29 Mon Sep 17 00:00:00 2001
From: Michael Buckley <michael@buckleyisms.com>
Date: Thu, 6 Jan 2022 13:56:22 -0800
Subject: [PATCH] Fix a memcmp errors in code that was changed from memmem to
memcmp (#656)
Notes:
Fixed supported algo prefs list check when upgrading rsa keys
Credit: Michael Buckley
Conflict:NA
Reference:https://github.com/libssh2/commit/13ad7b2f5cd67e0dc843098ce19ce8b208368c29
---
src/userauth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/userauth.c b/src/userauth.c
index 988dc17..29f58ba 100644
--- a/src/userauth.c
+++ b/src/userauth.c
@@ -1147,7 +1147,7 @@ _libssh2_key_sign_algorithm(LIBSSH2_SESSION *session,
f = strchr(a, ',');
f_len = f ? (f - a) : (int) strlen(a);
- if(f_len == p_len && memcmp(a, s, p_len)) {
+ if(f_len == p_len && memcmp(a, s, p_len) == 0) {
if(i != filtered_algs) {
memcpy(i, ",", 1);
@@ -1185,7 +1185,7 @@ _libssh2_key_sign_algorithm(LIBSSH2_SESSION *session,
f = strchr(a, ',');
f_len = f ? (f - a) : (int) strlen(a);
- if(f_len == p_len && memcmp(a, s, p_len)) {
+ if(f_len == p_len && memcmp(a, s, p_len) == 0) {
/* found a match, upgrade key method */
match = s;
match_len = p_len;
--
2.23.0