From 29ff5d3f89c7658035f28cbfab86634bc41b8c0c Mon Sep 17 00:00:00 2001 From: Max Lv Date: Sat, 13 Jan 2018 09:17:18 +0800 Subject: [PATCH] Avoid overwriting dst_addr --- src/udprelay.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/udprelay.c b/src/udprelay.c index f019a7cc..ed301adf 100644 --- a/src/udprelay.c +++ b/src/udprelay.c @@ -755,9 +755,8 @@ remote_recv_cb(EV_P_ ev_io *w, int revents) rx += buf->len; // Reconstruct UDP response header - char addr_header_buf[512]; - int addr_header_len = construct_udprelay_header(&src_addr, addr_header_buf); - char *addr_header = addr_header_buf; + char addr_header[512]; + int addr_header_len = construct_udprelay_header(&src_addr, addr_header); // Construct packet brealloc(buf, buf->len + addr_header_len, buf_size); @@ -1210,8 +1209,6 @@ server_recv_cb(EV_P_ ev_io *w, int revents) cache_hit = 1; if (dst_addr.ss_family != AF_INET && dst_addr.ss_family != AF_INET6) { need_query = 1; - } else { - memcpy(&dst_addr, &remote_ctx->dst_addr, sizeof(struct sockaddr_storage)); } } else { if (dst_addr.ss_family == AF_INET || dst_addr.ss_family == AF_INET6) {