Update local.c

This commit is contained in:
starter48
2023-01-09 10:53:26 +07:00
committed by GitHub
parent 6f2e821b9f
commit 2c68b7877f
+3 -3
View File
@@ -382,7 +382,7 @@ server_handshake(EV_P_ ev_io *w, buffer_t *buf)
abuf->len += in_addr_len + 2;
if (acl || verbose) {
uint16_t p = load16_be(buf->data + request_len + in_addr_len);
uint16_t p = ntohs(*(uint16_t*)(buf->data + request_len + in_addr_len));
if (!inet_ntop(AF_INET, (const void *)(buf->data + request_len),
ip, INET_ADDRSTRLEN)) {
LOGI("inet_ntop(AF_INET): %s", strerror(errno));
@@ -400,7 +400,7 @@ server_handshake(EV_P_ ev_io *w, buffer_t *buf)
abuf->len += name_len + 2;
if (acl || verbose) {
uint16_t p = load16_be(buf->data + request_len + 1 + name_len);
uint16_t p = ntohs(*(uint16_t*)(buf->data + request_len + 1 + name_len));
memcpy(host, buf->data + request_len + 1, name_len);
host[name_len] = '\0';
sprintf(port, "%d", p);
@@ -414,7 +414,7 @@ server_handshake(EV_P_ ev_io *w, buffer_t *buf)
abuf->len += in6_addr_len + 2;
if (acl || verbose) {
uint16_t p = load16_be(buf->data + request_len + in6_addr_len);
uint16_t p = ntohs(*(uint16_t*)(buf->data + request_len + in6_addr_len));
if (!inet_ntop(AF_INET6, (const void *)(buf->data + request_len),
ip, INET6_ADDRSTRLEN)) {
LOGI("inet_ntop(AF_INET6): %s", strerror(errno));