From 394da47a0a2da4a8617a16ff1af5dac77c475230 Mon Sep 17 00:00:00 2001 From: nnposter Date: Tue, 17 Nov 2026 22:20:49 +0000 Subject: [PATCH] Do not assume that int is of the same size as size_t. Close #3614 --- nping/utils_net.cc | 4 ++-- nse_zlib.cc | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nping/utils_net.cc b/nping/utils_net.cc index ed2e747b1..816a40e85 100644 --- a/nping/utils_net.cc +++ b/nping/utils_net.cc @@ -72,8 +72,8 @@ extern NpingOps o; int atoIP(const char *hostname, struct in_addr *dst){ struct sockaddr_in i; - unsigned int stlen=0; - if ( resolve(hostname, 0, (sockaddr_storage*)&i, (size_t *)&stlen , PF_INET) != 0 ) + size_t stlen=0; + if ( resolve(hostname, 0, (sockaddr_storage*)&i, &stlen , PF_INET) != 0 ) return OP_FAILURE; *dst=i.sin_addr; return OP_SUCCESS; diff --git a/nse_zlib.cc b/nse_zlib.cc index 7a22e818e..70c1932f9 100644 --- a/nse_zlib.cc +++ b/nse_zlib.cc @@ -625,6 +625,7 @@ static int lzstream_lines(lua_State *L) { static int lzstream_docompress(lua_State *L, lz_stream *s, int from, int to, int flush) { int r, arg; int self = 0; + size_t avail_in; size_t b_size = s->o_buffer_max; unsigned char *b = (unsigned char *)s->o_buffer; @@ -636,7 +637,8 @@ static int lzstream_docompress(lua_State *L, lz_stream *s, int from, int to, int } for (arg = from; arg <= to; arg++) { - s->zstream.next_in = (unsigned char*)luaL_checklstring(L, arg, (size_t*)&s->zstream.avail_in); + s->zstream.next_in = (unsigned char*)luaL_checklstring(L, arg, &avail_in); + s->zstream.avail_in = avail_in; do { s->zstream.next_out = b;