From 0d823e702bfe5f2bb5be694030a98afedf34aa6b Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 9 May 2024 00:45:43 +0200 Subject: socket: fix addrinfo() with omitted service argument Actually pass NULL to getaddrinfo() when the service argument is omitted, instead of incorrectly translating it to a string containing "null". Signed-off-by: Jo-Philipp Wich --- lib/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/socket.c b/lib/socket.c index a347f78..d0bd152 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -2006,7 +2006,7 @@ uc_socket_addrinfo(uc_vm_t *vm, size_t nargs) return NULL; } - servstr = (ucv_type(serv) != UC_STRING) ? ucv_to_string(vm, serv) : NULL; + servstr = (serv && ucv_type(serv) != UC_STRING) ? ucv_to_string(vm, serv) : NULL; ret = getaddrinfo(ucv_string_get(host), servstr ? servstr : ucv_string_get(serv), ai_hints, &ai_res); -- cgit v1.2.3