More checks in mg_ws_send

This commit is contained in:
cpq committed 2021-01-02 12:20:08 +00:00
1 parent 2f9d2bbdf6
commit 1b0636c2d2
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -3941,7 +3941,7 @@ size_t mg_ws_send(struct mg_connection *c, const char *buf, size_t len,
}
LOG(LL_VERBOSE_DEBUG, ("WS out: %d [%.*s]", (int) len, (int) len, buf));
mg_send(c, buf, len);
if (c->is_client) {
if (c->is_client && c->send.buf != NULL) {
uint8_t *p = c->send.buf + c->send.len - len;
for (i = 0; i < len; i++) p[i] ^= mask[i & 3];
}
+1 -1
View File
@@ -95,7 +95,7 @@ size_t mg_ws_send(struct mg_connection *c, const char *buf, size_t len,
}
LOG(LL_VERBOSE_DEBUG, ("WS out: %d [%.*s]", (int) len, (int) len, buf));
mg_send(c, buf, len);
if (c->is_client) {
if (c->is_client && c->send.buf != NULL) {
uint8_t *p = c->send.buf + c->send.len - len;
for (i = 0; i < len; i++) p[i] ^= mask[i & 3];
}