Type-check argument to network-lookup-address-info

* src/process.c (Fnetwork_lookup_address_info): Check that the
"name" argument is a string, and mention 'puny-encode-domain'.
(Bug#73337)
This commit is contained in:
Robert Pluim 2024-09-18 17:19:28 +02:00
parent 0f0f21b7f2
commit 300d05ecb4

View file

@ -4711,6 +4711,9 @@ network_lookup_address_info_1 (Lisp_Object host, const char *service,
DEFUN ("network-lookup-address-info", Fnetwork_lookup_address_info, DEFUN ("network-lookup-address-info", Fnetwork_lookup_address_info,
Snetwork_lookup_address_info, 1, 3, 0, Snetwork_lookup_address_info, 1, 3, 0,
doc: /* Look up Internet Protocol (IP) address info of NAME. doc: /* Look up Internet Protocol (IP) address info of NAME.
NAME must be an ASCII-only string. For looking up internationalized
hostnames, use `puny-encode-domain' on the string first.
Optional argument FAMILY controls whether to look up IPv4 or IPv6 Optional argument FAMILY controls whether to look up IPv4 or IPv6
addresses. The default of nil means both, symbol `ipv4' means IPv4 addresses. The default of nil means both, symbol `ipv4' means IPv4
only, symbol `ipv6' means IPv6 only. only, symbol `ipv6' means IPv6 only.
@ -4730,6 +4733,8 @@ returned from the lookup. */)
struct addrinfo *res, *lres; struct addrinfo *res, *lres;
struct addrinfo hints; struct addrinfo hints;
CHECK_STRING (name);
memset (&hints, 0, sizeof hints); memset (&hints, 0, sizeof hints);
if (NILP (family)) if (NILP (family))
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;