1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-22 04:02:04 +03:00

Cast to size_t rather than int

The result of the bit shift is assigned to a size_t data_len so we should
do the shift in size_t space.
This commit is contained in:
Matt Clarkson
2015-07-15 21:47:46 +01:00
parent 2a71a1dd6f
commit 0dc73824a2

View File

@@ -7133,7 +7133,7 @@ static void read_websocket(struct mg_connection *conn,
header_len = 2 + mask_len;
} else if (len == 126 && body_len >= 4 + mask_len) {
header_len = 4 + mask_len;
data_len = ((((int)buf[2]) << 8) + buf[3]);
data_len = ((((size_t)buf[2]) << 8) + buf[3]);
} else if (body_len >= 10 + mask_len) {
header_len = 10 + mask_len;
data_len = (((uint64_t)ntohl(*(uint32_t *)&buf[2])) << 32) +