Correctly check for memcmp() return value (it returns 0 if the strings match).

This is not really important, since curl is going to use http/1.1 anyway, but
it's still a bug I guess.

Cheers
From 29ad3e7659beb5b85709ac1c3df6a6ac3b11a7b9 Mon Sep 17 00:00:00 2001
From: Alessandro Ghedini <[email protected]>
Date: Thu, 19 Feb 2015 19:58:28 +0100
Subject: [PATCH] nss: fix NPN/ALPN protocol negotiation

Correctly check for memcmp() return value (it returns 0 if the strings match).

This is not really important, since curl is going to use http/1.1 anyway, but
it's still a bug I guess.
---
 lib/vtls/nss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index f55c476..41139ac 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -722,8 +722,8 @@ static void HandshakeCallback(PRFileDesc *sock, void *arg)
        == 0) {
       conn->negnpn = NPN_HTTP2;
     }
-    else if(buflen == ALPN_HTTP_1_1_LENGTH && memcmp(ALPN_HTTP_1_1, buf,
-                                                     ALPN_HTTP_1_1_LENGTH)) {
+    else if(buflen == ALPN_HTTP_1_1_LENGTH &&
+            memcmp(ALPN_HTTP_1_1, buf, ALPN_HTTP_1_1_LENGTH) == 0) {
       conn->negnpn = NPN_HTTP1_1;
     }
   }
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to