Websocket offset validation enhancement

This commit is contained in:
robert committed 2025-05-09 06:04:34 -04:00
1 parent 539d080346
commit cdc439bc38
3 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -219,7 +219,7 @@ static void mg_ws_cb(struct mg_connection *c, int ev, void *ev_data) {
// Remove non-fragmented frame
if (final && op) mg_iobuf_del(&c->recv, ofs, len);
// Last chunk of the fragmented frame
if (final && !op) {
if (final && !op && (ofs > 0)) {
m.flags = c->recv.buf[0];
m.data = mg_str_n((char *) &c->recv.buf[1], (size_t) (ofs - 1));
mg_call(c, MG_EV_WS_MSG, &m);