]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: compare sha256 strings case sensitively
authorDaniel Stenberg <daniel@haxx.se>
Mon, 25 Apr 2022 09:41:20 +0000 (11:41 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 25 Apr 2022 09:41:20 +0000 (11:41 +0200)
Reported-by: Harry Sintonen
Bug: https://hackerone.com/reports/1549435
Closes #8744

lib/vssh/libssh2.c

index 24cad59b3c65d53aa6b702bc35df3c58e02efac8..81ee6717428a557a289c7000cf3ef1b8c3bbf54d 100644 (file)
@@ -694,12 +694,12 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
      * against a known fingerprint, if available.
      */
     if((pub_pos != b64_pos) ||
-        Curl_strncasecompare(fingerprint_b64, pubkey_sha256, pub_pos) != 1) {
+       strncmp(fingerprint_b64, pubkey_sha256, pub_pos)) {
       free(fingerprint_b64);
 
       failf(data,
-          "Denied establishing ssh session: mismatch sha256 fingerprint. "
-          "Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256);
+            "Denied establishing ssh session: mismatch sha256 fingerprint. "
+            "Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256);
       state(data, SSH_SESSION_FREE);
       sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
       return sshc->actualcode;