From b64a011bf4e44317cb171487b65fc8af26de1517 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Tue, 8 Apr 2014 09:17:29 +0200 Subject: [PATCH] coverity: fix a false positive in SNMP transport `remote` is not expected to be a NULL-terminated string. However, just in case it is used as one somewhere, we alloc the appropriate space for it. --- src/daemon/agent_priv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/daemon/agent_priv.c b/src/daemon/agent_priv.c index ee143825..10929e47 100644 --- a/src/daemon/agent_priv.c +++ b/src/daemon/agent_priv.c @@ -148,7 +148,7 @@ agent_priv_unix_transport(const char *string, int len, int local) t->flags = NETSNMP_TRANSPORT_FLAG_STREAM; if ((t->remote = (u_char *) - malloc(strlen(addr.sun_path))) == NULL) { + calloc(1, strlen(addr.sun_path) + 1)) == NULL) { agent_priv_unix_close(t); netsnmp_transport_free(t); return NULL; -- 2.47.2