From d93c84f96e7b7e652ac5a937c1f27df0913fca18 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 11 Mar 2013 17:19:18 +0100 Subject: 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. --- include/snmp_mtp.h | 2 ++ src/sctp_m2ua.c | 1 - tests/mgcp/mgcp_patch_test.c | 2 +- 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 + #include #include #include 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; } -- cgit v1.2.3