From: Vincent Bernat Date: Tue, 8 Apr 2014 07:17:29 +0000 (+0200) Subject: coverity: fix a false positive in SNMP transport X-Git-Tag: 0.7.8~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b64a011bf4e44317cb171487b65fc8af26de1517;p=thirdparty%2Flldpd.git 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. --- 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;