diff options
author | Jo-Philipp Wich <jo@mein.io> | 2024-05-09 00:45:43 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2024-05-09 00:45:43 +0200 |
commit | 0d823e702bfe5f2bb5be694030a98afedf34aa6b (patch) | |
tree | 9fba778d6519a8660b815aa69582962c014520b6 | |
parent | b594ff8a2841975c36b69bf5eba4abbc2fffcc35 (diff) |
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 <jo@mein.io>
-rw-r--r-- | lib/socket.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |