aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-03-11 17:19:18 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-03-18 19:03:44 +0100
commitd93c84f96e7b7e652ac5a937c1f27df0913fca18 (patch)
tree4c91465c51b135410dcda6f4d76a12f6ba43e426
parente6caed12caa117de4d28111d9302d542963b1836 (diff)
misc: Address warnings coming from clang
* Include stdlib.h before the snmp headers to have a free declaration * Use sprintf(dest, "%s", str) to avoid format string attacks * Avoid bogus assignment. This pattern was used for marking something as unused in the past.
-rw-r--r--include/snmp_mtp.h2
-rw-r--r--src/sctp_m2ua.c1
-rw-r--r--tests/mgcp/mgcp_patch_test.c2
3 files changed, 3 insertions, 2 deletions
diff --git a/include/snmp_mtp.h b/include/snmp_mtp.h
index 0c3075f..bff5507 100644
--- a/include/snmp_mtp.h
+++ b/include/snmp_mtp.h
@@ -20,6 +20,8 @@
#ifndef snmp_mtp_h
#define snmp_mtp_h
+#include <stdlib.h>
+
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/utilities.h>
#include <net-snmp/net-snmp-includes.h>
diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c
index a94ec85..43deb52 100644
--- a/src/sctp_m2ua.c
+++ b/src/sctp_m2ua.c
@@ -47,7 +47,6 @@ int sctp_m2ua_conn_count(struct sctp_m2ua_transport *trans)
static struct mtp_m2ua_link *find_m2ua_link(struct sctp_m2ua_transport *trans, int link_index)
{
struct mtp_m2ua_link *link;
- link_index = link_index;
llist_for_each_entry(link, &trans->links, entry) {
if (link->link_index == link_index)
diff --git a/tests/mgcp/mgcp_patch_test.c b/tests/mgcp/mgcp_patch_test.c
index 68d163d..3153ecd 100644
--- a/tests/mgcp/mgcp_patch_test.c
+++ b/tests/mgcp/mgcp_patch_test.c
@@ -197,7 +197,7 @@ static struct msgb *create_msg(const char *str)
struct msgb *msg;
msg = msgb_alloc_headroom(4096, 128, "MGCP msg");
- int len = sprintf((char *)msg->data, str);
+ int len = sprintf((char *)msg->data, "%s", str);
msg->l2h = msgb_put(msg, len);
return msg;
}