Skip to content

Commit

Permalink
pmd: fix buffer being reused while draining extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnywong authored and lws-team committed Nov 23, 2023
1 parent 5442cf7 commit 57d539e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/roles/ws/ops-ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ lws_ws_rx_sm(struct lws *wsi, char already_processed, unsigned char c)
}

#if !defined(LWS_WITHOUT_EXTENSIONS)
if (!lin)
if (!lin && !(already_processed & ALREADY_PROCESSED_FULL_DRAINING))
break;
#endif

Expand Down
1 change: 1 addition & 0 deletions lib/roles/ws/private-lib-roles-ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ enum lws_websocket_opcodes_07 {

#define ALREADY_PROCESSED_IGNORE_CHAR 1
#define ALREADY_PROCESSED_NO_CB 2
#define ALREADY_PROCESSED_FULL_DRAINING 4

#if !defined(LWS_WITHOUT_EXTENSIONS)
struct lws_vhost_role_ws {
Expand Down
2 changes: 1 addition & 1 deletion lib/roles/ws/server-ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ lws_parse_ws(struct lws *wsi, unsigned char **buf, size_t len)
wsi->ws->rx_draining_ext);
#endif
m = lws_ws_rx_sm(wsi, ALREADY_PROCESSED_IGNORE_CHAR |
ALREADY_PROCESSED_NO_CB, 0);
ALREADY_PROCESSED_NO_CB | ALREADY_PROCESSED_FULL_DRAINING, 0);
}

if (m < 0) {
Expand Down

0 comments on commit 57d539e

Please sign in to comment.