[master] 20be063 We don't need to use strncpy() when we explicitly checked the length already. (This appearantly confuses Coverity ?)
Poul-Henning Kamp
phk at FreeBSD.org
Thu Apr 30 13:31:51 CEST 2015
commit 20be063efb00c390f2586f5b4aff15d47461d337
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Apr 30 11:31:13 2015 +0000
We don't need to use strncpy() when we explicitly checked the
length already. (This appearantly confuses Coverity ?)
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index e0ad875..2544890 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -401,9 +401,9 @@ identify(const char *i_arg)
strcpy(id, "varnishd");
if (i_arg != NULL) {
- if (strlen(i_arg) + 1 >= sizeof heritage.identity)
+ if (strlen(i_arg) + 1 > sizeof heritage.identity)
ARGV_ERR("Identity (-i) name too long.\n");
- strncpy(heritage.identity, i_arg, sizeof heritage.identity);
+ strcpy(heritage.identity, i_arg);
i = strlen(id);
id[i++] = '/';
for (; i < (sizeof(id) - 1L); i++) {
More information about the varnish-commit
mailing list