Skip to content

Commit cacaca6

Browse files
committed
let's do ftp extension while at it
1 parent addf152 commit cacaca6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ext/ftp/ftp.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
#include <openssl/err.h>
5757
#endif
5858

59+
#ifndef HAVE_INET_NTOP
60+
#error inet_ntop unsupported on this platform
61+
#endif
62+
5963
#include "ftp.h"
6064
#include "ext/standard/fsock.h"
6165

@@ -1685,13 +1689,16 @@ ftp_getdata(ftpbuf_t *ftp)
16851689

16861690
data->listener = fd;
16871691

1688-
#if defined(HAVE_IPV6) && defined(HAVE_INET_NTOP)
1692+
#if defined(HAVE_IPV6)
16891693
if (sa->sa_family == AF_INET6) {
16901694
/* need to use EPRT */
16911695
char eprtarg[INET6_ADDRSTRLEN + sizeof("|x||xxxxx|")];
16921696
char out[INET6_ADDRSTRLEN];
16931697
int eprtarg_len;
1694-
inet_ntop(AF_INET6, &((struct sockaddr_in6*) sa)->sin6_addr, out, sizeof(out));
1698+
if (!inet_ntop(AF_INET6, &((struct sockaddr_in6*) sa)->sin6_addr, out, sizeof(out))) {
1699+
goto bail;
1700+
}
1701+
16951702
eprtarg_len = snprintf(eprtarg, sizeof(eprtarg), "|2|%s|%hu|", out, ntohs(((struct sockaddr_in6 *) &addr)->sin6_port));
16961703

16971704
if (eprtarg_len < 0) {

0 commit comments

Comments
 (0)