From 48d2267d2d05bf4acaa2ae4e00e3d9b600cce235 Mon Sep 17 00:00:00 2001 From: russell Date: Tue, 18 Mar 2008 15:58:50 +0000 Subject: Merged revisions 109447 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r109447 | twilson | 2008-03-18 10:43:34 -0500 (Tue, 18 Mar 2008) | 3 lines Go through and fix a bunch of places where character strings were being interpreted as format strings. Most of these changes are solely to make compiling with -Wsecurity and -Wformat=2 happy, and were not actual problems, per se. I also added format attributes to any printf wrapper functions I found that didn't have them. -Wsecurity and -Wmissing-format-attribute added to --enable-dev-mode. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@109459 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_iax2.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'channels/chan_iax2.c') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 1df3cf3e8..9ec5045b5 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -788,7 +788,7 @@ static void iax_error_output(const char *data) ast_log(LOG_WARNING, "%s", data); } -static void jb_error_output(const char *fmt, ...) +static void __attribute__((format (printf, 1, 2))) jb_error_output(const char *fmt, ...) { va_list args; char buf[1024]; @@ -797,10 +797,10 @@ static void jb_error_output(const char *fmt, ...) vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - ast_log(LOG_ERROR, buf); + ast_log(LOG_ERROR, "%s", buf); } -static void jb_warning_output(const char *fmt, ...) +static void __attribute__((format (printf, 1, 2))) jb_warning_output(const char *fmt, ...) { va_list args; char buf[1024]; @@ -809,10 +809,10 @@ static void jb_warning_output(const char *fmt, ...) vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - ast_log(LOG_WARNING, buf); + ast_log(LOG_WARNING, "%s", buf); } -static void jb_debug_output(const char *fmt, ...) +static void __attribute__((format (printf, 1, 2))) jb_debug_output(const char *fmt, ...) { va_list args; char buf[1024]; @@ -821,7 +821,7 @@ static void jb_debug_output(const char *fmt, ...) vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - ast_verbose(buf); + ast_verbose("%s", buf); } /*! @@ -5173,11 +5173,12 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt) { int x; int numchans = 0; +#define ACN_FORMAT1 "%-25.25s %4d %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d\n" +#define ACN_FORMAT2 "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n" for (x=0;xowner ? iaxs[x]->owner->name : "(None)", iaxs[x]->pingtime, localjitter, @@ -5220,7 +5217,7 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt) iaxs[x]->remote_rr.ooo, iaxs[x]->remote_rr.packets/1000); else - ast_cli(fd, fmt, + ast_cli(fd, limit_fmt ? ACN_FORMAT1 : ACN_FORMAT2, iaxs[x]->owner ? iaxs[x]->owner->name : "(None)", iaxs[x]->pingtime, localjitter, -- cgit v1.2.3