From: Alessandro Ghedini Date: Thu, 19 Feb 2015 18:55:59 +0000 (+0100) Subject: polarssl: fix ALPN protocol negotiation X-Git-Tag: curl-7_41_0~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=633b3895d7a18ed8ddf3ae69dd08fe9eb1f0edb9;p=thirdparty%2Fcurl.git polarssl: fix ALPN protocol negotiation Correctly check for strncmp() return value (it returns 0 if the strings match). --- diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c index ca7e807756..5c75197357 100644 --- a/lib/vtls/polarssl.c +++ b/lib/vtls/polarssl.c @@ -468,11 +468,11 @@ polarssl_connect_step2(struct connectdata *conn, if(next_protocol != NULL) { infof(data, "ALPN, server accepted to use %s\n", next_protocol); - if(strncmp(next_protocol, NGHTTP2_PROTO_VERSION_ID, + if(!strncmp(next_protocol, NGHTTP2_PROTO_VERSION_ID, NGHTTP2_PROTO_VERSION_ID_LEN)) { conn->negnpn = NPN_HTTP2; } - else if(strncmp(next_protocol, ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH)) { + else if(!strncmp(next_protocol, ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH)) { conn->negnpn = NPN_HTTP1_1; } }