From 5bf65788ea380e1e4d6a978bb4459807a14c2724 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 25 Sep 2011 10:46:31 +0100 Subject: [PATCH] fix failure to limit 7bit lengths Reported-by: Tran Le Hung Reported-by: Tobias Maier Signed-off-by: Andy Green --- lib/parsers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/parsers.c b/lib/parsers.c index 52f1b7d..01d360b 100644 --- a/lib/parsers.c +++ b/lib/parsers.c @@ -495,7 +495,7 @@ handle_first: wsi->this_frame_masked = !!(c & 0x80); - switch (c) { + switch (c & 0x7f) { case 126: /* control frames are not allowed to have big lengths */ if (wsi->opcode & 8) @@ -959,7 +959,7 @@ int libwebsocket_client_rx_sm(struct libwebsocket *wsi, unsigned char c) wsi->this_frame_masked = !!(c & 0x80); - switch (c) { + switch (c & 0x7f) { case 126: /* control frames are not allowed to have big lengths */ if (wsi->opcode & 8) -- 2.7.4