diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c
index 106ba488bee0b4b353a21c8763225fad021dcfad..84138234ebffd89de0329f54e16adb8d41da2851 100644
--- a/res/res_http_websocket.c
+++ b/res/res_http_websocket.c
@@ -490,7 +490,7 @@ const char * AST_OPTIONAL_API_NAME(ast_websocket_session_id)(struct ast_websocke
  */
 static inline int ws_safe_read(struct ast_websocket *session, char *buf, int len, enum ast_websocket_opcode *opcode)
 {
-	size_t rlen;
+	ssize_t rlen;
 	int xlen = len;
 	char *rbuf = buf;
 	int sanity = 10;