c8cd03
From 1f3ac11cb4ecfab52f517ebf78493b0f05318be2 Mon Sep 17 00:00:00 2001
c8cd03
From: Evan Hunt <each@isc.org>
c8cd03
Date: Mon, 16 Jun 2014 15:31:04 -0700
c8cd03
Subject: [PATCH] [v9_9] null terminate strings for coverity
c8cd03
c8cd03
---
c8cd03
 bin/dig/dig.c                         | 1 +
c8cd03
 bin/tests/system/dlzexternal/driver.c | 6 ++++++
c8cd03
 2 files changed, 7 insertions(+)
c8cd03
c8cd03
diff --git a/bin/dig/dig.c b/bin/dig/dig.c
c8cd03
index 8a5fead..6af0964 100644
c8cd03
--- a/bin/dig/dig.c
c8cd03
+++ b/bin/dig/dig.c
c8cd03
@@ -1453,6 +1453,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
c8cd03
 				ip6_int, ISC_FALSE) == ISC_R_SUCCESS) {
c8cd03
 			strncpy((*lookup)->textname, textname,
c8cd03
 				sizeof((*lookup)->textname));
c8cd03
+			(*lookup)->textname[sizeof((*lookup)->textname)-1] = 0;
c8cd03
 			debug("looking up %s", (*lookup)->textname);
c8cd03
 			(*lookup)->trace_root = ISC_TF((*lookup)->trace  ||
c8cd03
 						(*lookup)->ns_search_only);
c8cd03
diff --git a/bin/tests/system/dlzexternal/driver.c b/bin/tests/system/dlzexternal/driver.c
c8cd03
index 053c25a..f99ac14 100644
c8cd03
--- a/bin/tests/system/dlzexternal/driver.c
c8cd03
+++ b/bin/tests/system/dlzexternal/driver.c
c8cd03
@@ -133,8 +133,14 @@ add_name(struct dlz_example_data *state, struct record *list,
c8cd03
 		return (ISC_R_NOSPACE);
c8cd03
 
c8cd03
 	strncpy(list[i].name, name, sizeof(list[i].name));
c8cd03
+	list[i].name[sizeof(list[i].name) - 1] = '\0';
c8cd03
+
c8cd03
 	strncpy(list[i].type, type, sizeof(list[i].type));
c8cd03
+	list[i].type[sizeof(list[i].type) - 1] = '\0';
c8cd03
+
c8cd03
 	strncpy(list[i].data, data, sizeof(list[i].data));
c8cd03
+	list[i].data[sizeof(list[i].data) - 1] = '\0';
c8cd03
+
c8cd03
 	list[i].ttl = ttl;
c8cd03
 
c8cd03
 	return (ISC_R_SUCCESS);
c8cd03
-- 
c8cd03
2.9.3
c8cd03