From cf28c0b7f085488bd74d950a79c2d6883b018f6a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 30 Jun 2026 18:49:49 +0200 Subject: [PATCH] ntop w/o result --- lib/ftp.c | 4 ++-- lib/hostip.c | 6 ++++-- lib/httpsrr.c | 2 +- lib/if2ip.c | 4 ++-- lib/urlapi.c | 2 +- tests/server/dnsd.c | 4 ++-- tests/unit/unit1961.c | 6 +++--- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/ftp.c b/lib/ftp.c index abcc9d25a9..bc8351cbd9 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1033,11 +1033,11 @@ static CURLcode ftp_port_default_host(struct Curl_easy *data, switch(sa->sa_family) { #ifdef USE_IPV6 case AF_INET6: - r = curlx_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, hbuflen); + r = curlx_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, hbuflen, NULL); break; #endif default: - r = curlx_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, hbuflen); + r = curlx_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, hbuflen, NULL); break; } if(!r) diff --git a/lib/hostip.c b/lib/hostip.c index 7427f8fdd9..d63585f518 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -182,14 +182,16 @@ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, case AF_INET: { const struct sockaddr_in *sa4 = (const void *)ai->ai_addr; const struct in_addr *ipaddr4 = &sa4->sin_addr; - (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize); + (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize, + NULL); break; } #ifdef USE_IPV6 case AF_INET6: { const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr; const struct in6_addr *ipaddr6 = &sa6->sin6_addr; - (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize); + (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize, + NULL); break; } #endif diff --git a/lib/httpsrr.c b/lib/httpsrr.c index 441fe350b1..ac2fc2ffc9 100644 --- a/lib/httpsrr.c +++ b/lib/httpsrr.c @@ -82,7 +82,7 @@ static CURLcode httpsrr_print_addr(struct dynbuf *dyn, CURLcode result = CURLE_OK; for(i = 0; (i < (total_len / alen)) && !result; ++i) { - if(!curlx_inet_ntop(ai_family, addr + (i * alen), buf, sizeof(buf))) + if(!curlx_inet_ntop(ai_family, addr + (i * alen), buf, sizeof(buf), NULL)) result = curlx_dyn_add(dyn, ""); else result = curlx_dyn_addf(dyn, "%s%s", sep, buf); diff --git a/lib/if2ip.c b/lib/if2ip.c index 5ae256e13c..d8b7f0142a 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -155,7 +155,7 @@ if2ip_result_t Curl_if2ip(int af, addr = &((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr; res = IF2IP_FOUND; - ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr)); + ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr), NULL); curl_msnprintf(buf, buf_size, "%s%s", ip, scope); break; } @@ -228,7 +228,7 @@ if2ip_result_t Curl_if2ip(int af, s = (struct sockaddr_in *)(void *)&req.ifr_addr; memcpy(&in, &s->sin_addr, sizeof(in)); - r = curlx_inet_ntop(s->sin_family, &in, buf, buf_size); + r = curlx_inet_ntop(s->sin_family, &in, buf, buf_size, NULL); sclose(dummy); if(!r) diff --git a/lib/urlapi.c b/lib/urlapi.c index b4dfdda678..e63b960c41 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -466,7 +466,7 @@ UNITTEST CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname, hostname[hlen] = 0; /* end the address there */ if(curlx_inet_pton(AF_INET6, hostname, dest) != 1) return CURLUE_BAD_IPV6; - if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen + 1)) { + if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen + 1, NULL)) { hlen = strlen(hostname); /* might be shorter now */ hostname[hlen + 1] = 0; } diff --git a/tests/server/dnsd.c b/tests/server/dnsd.c index 9d460d9452..73a6ebeb5c 100644 --- a/tests/server/dnsd.c +++ b/tests/server/dnsd.c @@ -508,7 +508,7 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen, const char *ip; if(add_answer(&resp->body, store, sizeof(ipv4_pref), QTYPE_A)) goto error; - ip = curlx_inet_ntop(AF_INET, store, addrbuf, sizeof(addrbuf)); + ip = curlx_inet_ntop(AF_INET, store, addrbuf, sizeof(addrbuf), NULL); logmsg("[%d] response A (%x) '%s'", qid, (unsigned int)QTYPE_A, ip ? ip : "(null)"); } @@ -521,7 +521,7 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen, const char *ip; if(add_answer(&resp->body, store, sizeof(ipv6_pref), QTYPE_AAAA)) goto error; - ip = curlx_inet_ntop(AF_INET6, store, addrbuf, sizeof(addrbuf)); + ip = curlx_inet_ntop(AF_INET6, store, addrbuf, sizeof(addrbuf), NULL); logmsg("[%d] response AAAA (%x) '%s'", qid, (unsigned int)QTYPE_AAAA, ip ? ip : "(null)"); } diff --git a/tests/unit/unit1961.c b/tests/unit/unit1961.c index 338eeb176b..84d6e12d1f 100644 --- a/tests/unit/unit1961.c +++ b/tests/unit/unit1961.c @@ -57,7 +57,7 @@ static int test_ntop(void) ipv4a[2] = 0x64; ipv4a[3] = 0x01; ipv4a[4] = 0x01; - ipv4ptr = curlx_inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); + ipv4ptr = curlx_inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res), NULL); if(!ipv4ptr) return 1; /* fail */ if(ipv4ptr != ipv4res) @@ -80,7 +80,7 @@ static int test_ntop(void) ipv6a[14] = 0x76; ipv6a[15] = 0xc8; ipv6a[25] = 0x01; - ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); + ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res), NULL); if(!ipv6ptr) return 1; /* fail */ if(ipv6ptr != ipv6res) @@ -96,7 +96,7 @@ static int test_ntop(void) ipv6a[13] = 0x0; ipv6a[14] = 0x0; ipv6a[15] = 0x01; - ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); + ipv6ptr = curlx_inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res), NULL); if(!ipv6ptr) return 1; /* fail */ if(ipv6ptr != ipv6res)