Skip to content

Commit

Permalink
polarssl: fix ALPN protocol negotiation
Browse files Browse the repository at this point in the history
Correctly check for strncmp() return value (it returns 0 if the strings
match).
  • Loading branch information
ghedo authored and bagder committed Feb 19, 2015
1 parent b723ec9 commit 633b389
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/vtls/polarssl.c
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 633b389

Please sign in to comment.