Skip to content
Suresoft-GLaDOS edited this page May 26, 2023 · 9 revisions

#1

Link : https://git.libssh.org/projects/libssh.git/commit/88d777e6782330be8d6916f672ae106a5bd32b10
Description: Fix format truncation in ssh_path_expand_escape()

At src/pki.c

@@ -724,7 +724,7 @@ int ssh_pki_import_privkey_base64(const char *b64_key,
                                   ssh_key *pkey)
 {
     ssh_key key;
+    char *openssh_header = NULL;
-    int cmp;
     if (b64_key == NULL || pkey == NULL) {
         return SSH_ERROR;
@@ -739,9 +739,9 @@ int ssh_pki_import_privkey_base64(const char *b64_key,
             passphrase ? "true" : "false");
     /* Test for OpenSSH key format first */
+    openssh_header = strstr(b64_key, OPENSSH_HEADER_BEGIN);
+    if (openssh_header != NULL) {
+        key = ssh_pki_openssh_privkey_import(openssh_header,
-    cmp = strncmp(b64_key, OPENSSH_HEADER_BEGIN, strlen(OPENSSH_HEADER_BEGIN));
-    if (cmp == 0) {
-        key = ssh_pki_openssh_privkey_import(b64_key,
                                              passphrase,
                                              auth_fn,
                                              auth_data);

Tags
#Logical-error #Multi-line #Modified

Clone this wiki locally