diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-07-15 09:47:16 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-07-15 09:47:16 +0200 |
commit | 163bc6d7fc268bdb1c7cc03699f69d0c5cc0b4cd (patch) | |
tree | eec08d80894534fefc488261dfcb9a5c246cb523 /src/socket.c | |
parent | 980784c1917f19bfd2e9b11faca76d14e8589daa (diff) |
New upstream version 4.14upstream/4.14
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c index 9b5d78a..0b6f674 100644 --- a/src/socket.c +++ b/src/socket.c @@ -86,8 +86,11 @@ int HX_addrport_split(const char *spec, char *host, unsigned long hlen = end - spec; if (hlen >= hbufsz) return -E2BIG; - if (*++end == '\0') + if (*++end == '\0') { + memmove(host, spec, hlen); + host[hlen] = '\0'; return 1; + } if (*end++ != ':') return -EINVAL; char *nend = nullptr; @@ -146,6 +149,8 @@ int HX_inet_connect(const char *host, uint16_t port, unsigned int oflags) struct addrinfo *aires = nullptr; int ret = HX_inet_lookup(host, port, AI_ADDRCONFIG, &aires); int saved_errno = 0; + if (ret != 0) + ; for (const struct addrinfo *r = aires; r != nullptr; r = r->ai_next) { int fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol); if (fd < 0) { |