mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-25 20:28:27 +00:00
Using unsigned char in deliver_websocket_frame() arithmetic
This commit is contained in:
1 parent
7abb406d0f
commit
58dab48156
1 file changed
+3
-2
+3
-2
@@ -1384,7 +1384,8 @@ static void send_websocket_handshake(struct mg_connection *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int deliver_websocket_frame(struct connection *conn) {
|
static int deliver_websocket_frame(struct connection *conn) {
|
||||||
char *buf = conn->local_iobuf.buf;
|
// Having buf unsigned char * is important, as it is used below in arithmetic
|
||||||
|
unsigned char *buf = (unsigned char *) conn->local_iobuf.buf;
|
||||||
int i, len, buf_len = conn->local_iobuf.len, frame_len = 0,
|
int i, len, buf_len = conn->local_iobuf.len, frame_len = 0,
|
||||||
mask_len = 0, header_len = 0, data_len = 0, buffered = 0;
|
mask_len = 0, header_len = 0, data_len = 0, buffered = 0;
|
||||||
|
|
||||||
@@ -1409,7 +1410,7 @@ static int deliver_websocket_frame(struct connection *conn) {
|
|||||||
|
|
||||||
if (buffered) {
|
if (buffered) {
|
||||||
conn->mg_conn.content_len = data_len;
|
conn->mg_conn.content_len = data_len;
|
||||||
conn->mg_conn.content = buf + header_len;
|
conn->mg_conn.content = (char *) buf + header_len;
|
||||||
conn->mg_conn.wsbits = buf[0];
|
conn->mg_conn.wsbits = buf[0];
|
||||||
|
|
||||||
// Apply mask if necessary
|
// Apply mask if necessary
|
||||||
|
|||||||
Reference in new issue
Block a user