瀏覽代碼

Make implicit conversion to size_t explicit

The code does the subtraction of two integers to determine the data
length. The data length is specified as size_t so an implicit
conversion is happening. This commit just makes that conversion
explicit.
Matt Clarkson 10 年之前
父節點
當前提交
2a71a1dd6f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/civetweb.c

+ 1 - 1
src/civetweb.c

@@ -7125,7 +7125,7 @@ static void read_websocket(struct mg_connection *conn,
 	while (!conn->ctx->stop_flag) {
 		header_len = 0;
 		assert(conn->data_len >= conn->request_len);
-		if ((body_len = conn->data_len - conn->request_len) >= 2) {
+		if ((body_len = (size_t)(conn->data_len - conn->request_len)) >= 2) {
 			len = buf[1] & 127;
 			mask_len = buf[1] & 128 ? 4 : 0;
 			if (len < 126 && body_len >= mask_len) {