From 31f9eeb9d6891c2ba17284ce4a28325cf13b2ff3 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Wed, 10 Dec 2014 16:32:44 +0100 Subject: [PATCH] client: fix verification of the accepted protocol to properly take ", *" as delimiter Signed-off-by: Alejandro Mery --- lib/client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/client.c b/lib/client.c index 4a094a83..831f985e 100755 --- a/lib/client.c +++ b/lib/client.c @@ -562,13 +562,13 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context, while (pc && *pc && !okay) { if (!strncmp(pc, p, len) && - (pc[len] == ',' || pc[len] == '\0')) { + (pc[len] == ',' || pc[len] == '\0')) { okay = 1; continue; } - while (*pc && *pc != ',') - pc++; - while (*pc && *pc != ' ') + while (*pc && *pc++ != ',') + ; + while (*pc && *pc == ' ') pc++; }