aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dns/dns.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-09-30 10:13:27 +0200
committerDave Barach <openvpp@barachs.net>2019-09-30 16:22:39 +0000
commit328c08d603bb0a9956b82553f1691fd8a5a5de7d (patch)
tree20e99da945605a59644709fa164f3e44a4fe55f4 /src/plugins/dns/dns.c
parentf26b2511cf661d4ebef32c19f944041637ec5907 (diff)
dns: fix non-NULL terminated C-string
Type: fix Change-Id: Ib030e6ac3386528901e0805d1ffe2eec033d819f Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/dns/dns.c')
-rw-r--r--src/plugins/dns/dns.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/dns/dns.c b/src/plugins/dns/dns.c
index 4a882ebddc1..a6dff672feb 100644
--- a/src/plugins/dns/dns.c
+++ b/src/plugins/dns/dns.c
@@ -797,6 +797,8 @@ dns_add_static_entry (dns_main_t * dm, u8 * name, u8 * dns_reply_data)
/* Note: consumes the name vector */
ep->name = name;
+ /* make sure it NULL-terminated as hash_set_mem will use strlen() */
+ vec_terminate_c_string (ep->name);
hash_set_mem (dm->cache_entry_by_name, ep->name, ep - dm->entries);
ep->flags = DNS_CACHE_ENTRY_FLAG_VALID | DNS_CACHE_ENTRY_FLAG_STATIC;
ep->dns_response = dns_reply_data;