소스 검색

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.
Matt Clarkson 10 년 전
부모
커밋
0dc73824a2
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/civetweb.c

+ 1 - 1
src/civetweb.c

@@ -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) +