Browse Source

Update local.c

pull/2953/head
starter48 2 years ago
committed by GitHub
parent
commit
2c68b7877f
1 changed files with 3 additions and 3 deletions
  1. 6
      src/local.c

6
src/local.c

@ -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));

Loading…
Cancel
Save