From 426330fffb024d3c2e4c6e34a16b04afef884d5d Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Tue, 28 Oct 2014 19:41:13 +0100 Subject: [PATCH] dns: use different buffers for encoding and decoding names dns_send_question was ocassionally called with a name from name_buf Signed-off-by: Steven Barth --- dns.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dns.c b/dns.c index c5323e5..89cd4ce 100644 --- a/dns.c +++ b/dns.c @@ -39,6 +39,7 @@ #include "interface.h" static char name_buffer[MAX_NAME_LEN + 1]; +static char dns_buffer[MAX_NAME_LEN]; static struct blob_buf ans_buf; const char* @@ -76,7 +77,7 @@ dns_send_question(struct interface *iface, const char *question, int type, int u .iov_len = sizeof(h), }, { - .iov_base = name_buffer, + .iov_base = dns_buffer, }, { .iov_base = &q, @@ -89,7 +90,7 @@ dns_send_question(struct interface *iface, const char *question, int type, int u q.class = cpu_to_be16(((unicast) ? (CLASS_UNICAST) : (0)) | 1); q.type = cpu_to_be16(type); - len = dn_comp(question, (void *) name_buffer, sizeof(name_buffer), NULL, NULL); + len = dn_comp(question, (void *) dns_buffer, sizeof(dns_buffer), NULL, NULL); if (len < 1) return; -- 2.30.2