[master] e2090b4 This cannot overflow the buffer, but Coverity can't guess that.

Poul-Henning Kamp phk at FreeBSD.org
Mon Feb 13 20:28:06 CET 2017


commit e2090b492848b262ba6206d2f24cfcdb0ea1a5f6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 13 19:27:20 2017 +0000

    This cannot overflow the buffer, but Coverity can't guess that.

diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 3ee8dc0..e45e29a 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -822,12 +822,10 @@ do_stat_dump_cb(void *priv, const struct VSC_point * const pt)
 	u = *(const volatile uint64_t*)pt->ptr;
 
 	strcpy(buf, pt->section->type);
-	if (pt->section->ident[0] != '\0') {
-		strcat(buf, ".");
-		strcat(buf, pt->section->ident);
-	}
-	strcat(buf, ".");
-	strcat(buf, pt->desc->name);
+	if (pt->section->ident[0] != '\0') 
+		bprintf(buf, ".%s.%s", pt->section->ident, pt->desc->name);
+	else
+		bprintf(buf, ".%s", pt->desc->name);
 
 	if (strcmp(dp->arg, "*")) {
 		if (fnmatch(dp->arg, buf, 0))



More information about the varnish-commit mailing list