diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2015-02-19 19:58:28 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-02-19 23:09:12 +0100 |
commit | 63b4b8c7bdb66e492daa89e8c20a5018082ddd29 (patch) | |
tree | 85819d5d8ed6d46a8ff937b77827528ee559f221 /lib | |
parent | 633b3895d7a18ed8ddf3ae69dd08fe9eb1f0edb9 (diff) |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vtls/nss.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index f55c4763e..16b9124f1 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -718,12 +718,11 @@ static void HandshakeCallback(PRFileDesc *sock, void *arg) } if(buflen == NGHTTP2_PROTO_VERSION_ID_LEN && - memcmp(NGHTTP2_PROTO_VERSION_ID, buf, NGHTTP2_PROTO_VERSION_ID_LEN) - == 0) { + !memcmp(NGHTTP2_PROTO_VERSION_ID, buf, NGHTTP2_PROTO_VERSION_ID_LEN)) { 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)) { conn->negnpn = NPN_HTTP1_1; } } |