aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--apps/app_festival.c24
-rw-r--r--apps/app_meetme.c8
-rw-r--r--apps/app_minivm.c28
-rw-r--r--apps/app_queue.c4
-rw-r--r--apps/app_voicemail.c24
-rw-r--r--cdr/cdr_sqlite3_custom.c2
-rw-r--r--channels/chan_iax2.c23
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_sip.c2
-rw-r--r--funcs/func_enum.c4
-rw-r--r--include/asterisk/astobj.h2
-rw-r--r--include/asterisk/strings.h2
-rw-r--r--include/asterisk/utils.h2
-rw-r--r--include/jitterbuf.h2
-rw-r--r--main/asterisk.c42
-rw-r--r--main/cli.c2
-rw-r--r--main/features.c16
-rw-r--r--main/jitterbuf.c2
-rw-r--r--main/manager.c18
-rw-r--r--main/translate.c2
-rw-r--r--main/utils.c4
-rw-r--r--res/res_agi.c2
-rw-r--r--res/res_config_ldap.c8
-rw-r--r--res/res_indications.c2
-rw-r--r--res/res_phoneprov.c2
-rw-r--r--res/res_realtime.c8
-rw-r--r--utils/astman.c8
-rw-r--r--utils/check_expr.c2
-rw-r--r--utils/extconf.c4
-rw-r--r--utils/frame.c11
31 files changed, 137 insertions, 127 deletions
diff --git a/Makefile b/Makefile
index 014464d03..510863ecc 100644
--- a/Makefile
+++ b/Makefile
@@ -229,7 +229,7 @@ ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
ifeq ($(AST_DEVMODE),yes)
- ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
+ ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT) -Wmissing-format-attribute -Wformat-security #-Wformat=2
endif
ifneq ($(findstring BSD,$(OSARCH)),)
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 926638e57..e788291ed 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -327,11 +327,21 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) {
cachedir = "/tmp/";
}
+
+ data = ast_strdupa(vdata);
+ AST_STANDARD_APP_ARGS(args, data);
+
if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
- festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
+ const char *startcmd = "(tts_textasterisk \"";
+ const char *endcmd = "\" 'file)(quit)\n";
+
+ strln = strlen(startcmd) + strlen(args.text) + strlen(endcmd) + 1;
+ newfestivalcommand = alloca(strln);
+ snprintf(newfestivalcommand, strln, "%s%s%s", startcmd, args.text, endcmd);
+ festivalcommand = newfestivalcommand;
} else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */
int i, j;
- newfestivalcommand = alloca(strlen(festivalcommand) + 1);
+ newfestivalcommand = alloca(strlen(festivalcommand) + strlen(args.text) + 1);
for (i = 0, j = 0; i < strlen(festivalcommand); i++) {
if (festivalcommand[i] == '\\' && festivalcommand[i + 1] == 'n') {
@@ -340,6 +350,10 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
} else if (festivalcommand[i] == '\\') {
newfestivalcommand[j++] = festivalcommand[i + 1];
i++;
+ } else if (festivalcommand[i] == '%' && festivalcommand[i + 1] == 's') {
+ sprintf(&newfestivalcommand[j], "%s", args.text); /* we know it is big enough */
+ j += strlen(args.text);
+ i++;
} else
newfestivalcommand[j++] = festivalcommand[i];
}
@@ -347,9 +361,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
festivalcommand = newfestivalcommand;
}
- data = ast_strdupa(vdata);
- AST_STANDARD_APP_ARGS(args, data);
-
if (args.interrupt && !strcasecmp(args.interrupt, "any"))
args.interrupt = AST_DIGIT_ANY;
@@ -440,7 +451,8 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
} else {
ast_debug(1, "Passing text to festival...\n");
fs = fdopen(dup(fd), "wb");
- fprintf(fs, festivalcommand, args.text);
+
+ fprintf(fs, "%s", festivalcommand);
fflush(fs);
fclose(fs);
}
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 368cc4539..a6967a34c 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -955,9 +955,9 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
int hr, min, sec;
int i = 0, total = 0;
time_t now;
- char *header_format = "%-14s %-14s %-10s %-8s %-8s %-6s\n";
- char *data_format = "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n";
char cmdline[1024] = "";
+#define MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s %-8s %-6s\n"
+#define MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n"
switch (cmd) {
case CLI_INIT:
@@ -989,7 +989,7 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
return CLI_SUCCESS;
}
if (!concise)
- ast_cli(a->fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked");
+ ast_cli(a->fd, MC_HEADER_FORMAT, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked");
AST_LIST_TRAVERSE(&confs, cnf, list) {
if (cnf->markedusers == 0)
strcpy(cmdline, "N/A ");
@@ -999,7 +999,7 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
min = ((now - cnf->start) % 3600) / 60;
sec = (now - cnf->start) % 60;
if (!concise)
- ast_cli(a->fd, data_format, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No");
+ ast_cli(a->fd, MC_DATA_FORMAT, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No");
else {
ast_cli(a->fd, "%s!%d!%d!%02d:%02d:%02d!%d!%d\n",
cnf->confno,
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index ae76f9e89..2b70d87e4 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -1560,10 +1560,10 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav
duration < global_vmminmessage ? "IGNORED" : "OK",
vmu->accountcode
);
- fprintf(txt, logbuf);
+ fprintf(txt, "%s", logbuf);
if (minivmlogfile) {
ast_mutex_lock(&minivmloglock);
- fprintf(minivmlogfile, logbuf);
+ fprintf(minivmlogfile, "%s", logbuf);
ast_mutex_unlock(&minivmloglock);
}
@@ -2474,7 +2474,7 @@ static int load_config(int reload)
static char *handle_minivm_list_templates(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct minivm_template *this;
- char *output_format = "%-15s %-10s %-10s %-15.15s %-50s\n";
+#define HVLT_OUTPUT_FORMAT "%-15s %-10s %-10s %-15.15s %-50s\n"
int count = 0;
switch (cmd) {
@@ -2497,10 +2497,10 @@ static char *handle_minivm_list_templates(struct ast_cli_entry *e, int cmd, stru
AST_LIST_UNLOCK(&message_templates);
return CLI_FAILURE;
}
- ast_cli(a->fd, output_format, "Template name", "Charset", "Locale", "Attach media", "Subject");
- ast_cli(a->fd, output_format, "-------------", "-------", "------", "------------", "-------");
+ ast_cli(a->fd, HVLT_OUTPUT_FORMAT, "Template name", "Charset", "Locale", "Attach media", "Subject");
+ ast_cli(a->fd, HVLT_OUTPUT_FORMAT, "-------------", "-------", "------", "------------", "-------");
AST_LIST_TRAVERSE(&message_templates, this, list) {
- ast_cli(a->fd, output_format, this->name,
+ ast_cli(a->fd, HVLT_OUTPUT_FORMAT, this->name,
this->charset ? this->charset : "-",
this->locale ? this->locale : "-",
this->attachment ? "Yes" : "No",
@@ -2540,7 +2540,7 @@ static char *complete_minivm_show_users(const char *line, const char *word, int
static char *handle_minivm_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct minivm_account *vmu;
- char *output_format = "%-23s %-15s %-15s %-10s %-10s %-50s\n";
+#define HMSU_OUTPUT_FORMAT "%-23s %-15s %-15s %-10s %-10s %-50s\n"
int count = 0;
switch (cmd) {
@@ -2565,14 +2565,14 @@ static char *handle_minivm_show_users(struct ast_cli_entry *e, int cmd, struct a
AST_LIST_UNLOCK(&minivm_accounts);
return CLI_FAILURE;
}
- ast_cli(a->fd, output_format, "User", "E-Template", "P-template", "Zone", "Format", "Full name");
- ast_cli(a->fd, output_format, "----", "----------", "----------", "----", "------", "---------");
+ ast_cli(a->fd, HMSU_OUTPUT_FORMAT, "User", "E-Template", "P-template", "Zone", "Format", "Full name");
+ ast_cli(a->fd, HMSU_OUTPUT_FORMAT, "----", "----------", "----------", "----", "------", "---------");
AST_LIST_TRAVERSE(&minivm_accounts, vmu, list) {
char tmp[256] = "";
if ((a->argc == 3) || ((a->argc == 5) && !strcmp(a->argv[4], vmu->domain))) {
count++;
snprintf(tmp, sizeof(tmp), "%s@%s", vmu->username, vmu->domain);
- ast_cli(a->fd, output_format, tmp, vmu->etemplate ? vmu->etemplate : "-",
+ ast_cli(a->fd, HMSU_OUTPUT_FORMAT, tmp, vmu->etemplate ? vmu->etemplate : "-",
vmu->ptemplate ? vmu->ptemplate : "-",
vmu->zonetag ? vmu->zonetag : "-",
vmu->attachfmt ? vmu->attachfmt : "-",
@@ -2588,7 +2588,7 @@ static char *handle_minivm_show_users(struct ast_cli_entry *e, int cmd, struct a
static char *handle_minivm_show_zones(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct minivm_zone *zone;
- char *output_format = "%-15s %-20s %-45s\n";
+#define HMSZ_OUTPUT_FORMAT "%-15s %-20s %-45s\n"
char *res = CLI_SUCCESS;
switch (cmd) {
@@ -2607,10 +2607,10 @@ static char *handle_minivm_show_zones(struct ast_cli_entry *e, int cmd, struct a
AST_LIST_LOCK(&minivm_zones);
if (!AST_LIST_EMPTY(&minivm_zones)) {
- ast_cli(a->fd, output_format, "Zone", "Timezone", "Message Format");
- ast_cli(a->fd, output_format, "----", "--------", "--------------");
+ ast_cli(a->fd, HMSZ_OUTPUT_FORMAT, "Zone", "Timezone", "Message Format");
+ ast_cli(a->fd, HMSZ_OUTPUT_FORMAT, "----", "--------", "--------------");
AST_LIST_TRAVERSE(&minivm_zones, zone, list) {
- ast_cli(a->fd, output_format, zone->name, zone->timezone, zone->msg_format);
+ ast_cli(a->fd, HMSZ_OUTPUT_FORMAT, zone->name, zone->timezone, zone->msg_format);
}
} else {
ast_cli(a->fd, "There are no voicemail zones currently defined\n");
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 7a4638c8f..ca109f9b6 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1233,13 +1233,13 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
while ((s = strsep(&buf, ",|"))) {
if (!q->sound_periodicannounce[i])
q->sound_periodicannounce[i] = ast_str_create(16);
- ast_str_set(&q->sound_periodicannounce[i], 0, s);
+ ast_str_set(&q->sound_periodicannounce[i], 0, "%s", s);
i++;
if (i == MAX_PERIODIC_ANNOUNCEMENTS)
break;
}
} else {
- ast_str_set(&q->sound_periodicannounce[0], 0, val);
+ ast_str_set(&q->sound_periodicannounce[0], 0, "%s", val);
}
} else if (!strcasecmp(param, "periodic-announce-frequency")) {
q->periodicannouncefrequency = atoi(val);
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 2a4f496b7..d0b8cc3ba 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -645,7 +645,6 @@ static char *pagerbody = NULL;
static char *pagersubject = NULL;
static char fromstring[100];
static char pagerfromstring[100];
-static char emailtitle[100];
static char charset[32] = "ISO-8859-1";
static unsigned char adsifdn[4] = "\x00\x00\x00\x0F";
@@ -2021,9 +2020,6 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
ast_channel_free(ast);
} else
ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
- } else if (!ast_strlen_zero(emailtitle)) {
- fprintf(p, emailtitle, msgnum + 1, mailbox) ;
- fprintf(p, ENDL) ;
} else if (ast_test_flag((&globalflags), VM_PBXSKIP))
fprintf(p, "Subject: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox);
else
@@ -7784,7 +7780,7 @@ static char *complete_voicemail_show_users(const char *line, const char *word, i
static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_vm_user *vmu;
- char *output_format = "%-10s %-5s %-25s %-10s %6s\n";
+#define HVSU_OUTPUT_FORMAT "%-10s %-5s %-25s %-10s %6s\n"
const char *context = NULL;
int users_counter = 0;
@@ -7822,7 +7818,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
return CLI_FAILURE;
}
if (a->argc == 3)
- ast_cli(a->fd, output_format, "Context", "Mbox", "User", "Zone", "NewMsg");
+ ast_cli(a->fd, HVSU_OUTPUT_FORMAT, "Context", "Mbox", "User", "Zone", "NewMsg");
else {
int count = 0;
AST_LIST_TRAVERSE(&users, vmu, list) {
@@ -7830,7 +7826,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
count++;
}
if (count) {
- ast_cli(a->fd, output_format, "Context", "Mbox", "User", "Zone", "NewMsg");
+ ast_cli(a->fd, HVSU_OUTPUT_FORMAT, "Context", "Mbox", "User", "Zone", "NewMsg");
} else {
ast_cli(a->fd, "No such voicemail context \"%s\"\n", context);
AST_LIST_UNLOCK(&users);
@@ -7845,7 +7841,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
snprintf(tmp, sizeof(tmp), "%s@%s", vmu->mailbox, ast_strlen_zero(vmu->context) ? "default" : vmu->context);
inboxcount(tmp, &newmsgs, &oldmsgs);
snprintf(count, sizeof(count), "%d", newmsgs);
- ast_cli(a->fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
+ ast_cli(a->fd, HVSU_OUTPUT_FORMAT, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
users_counter++;
}
}
@@ -7858,7 +7854,7 @@ static char *handle_voicemail_show_users(struct ast_cli_entry *e, int cmd, struc
static char *handle_voicemail_show_zones(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct vm_zone *zone;
- char *output_format = "%-15s %-20s %-45s\n";
+#define HVSZ_OUTPUT_FORMAT "%-15s %-20s %-45s\n"
char *res = CLI_SUCCESS;
switch (cmd) {
@@ -7877,9 +7873,9 @@ static char *handle_voicemail_show_zones(struct ast_cli_entry *e, int cmd, struc
AST_LIST_LOCK(&zones);
if (!AST_LIST_EMPTY(&zones)) {
- ast_cli(a->fd, output_format, "Zone", "Timezone", "Message Format");
+ ast_cli(a->fd, HVSZ_OUTPUT_FORMAT, "Zone", "Timezone", "Message Format");
AST_LIST_TRAVERSE(&zones, zone, list) {
- ast_cli(a->fd, output_format, zone->name, zone->timezone, zone->msg_format);
+ ast_cli(a->fd, HVSZ_OUTPUT_FORMAT, zone->name, zone->timezone, zone->msg_format);
}
} else {
ast_cli(a->fd, "There are no voicemail zones currently defined\n");
@@ -8706,7 +8702,6 @@ static int load_config(int reload)
}
memset(fromstring, 0, sizeof(fromstring));
memset(pagerfromstring, 0, sizeof(pagerfromstring));
- memset(emailtitle, 0, sizeof(emailtitle));
strcpy(charset, "ISO-8859-1");
if (emailbody) {
ast_free(emailbody);
@@ -8744,13 +8739,10 @@ static int load_config(int reload)
memcpy(&adsisec[x], &tmpadsi[x], 1);
}
}
- if ((val = ast_variable_retrieve(cfg, "general", "adsiver")))
+ if ((val = ast_variable_retrieve(cfg, "general", "adsiver"))) {
if (atoi(val)) {
adsiver = atoi(val);
}
- if ((val = ast_variable_retrieve(cfg, "general", "emailtitle"))) {
- ast_log(LOG_NOTICE, "Keyword 'emailtitle' is DEPRECATED, please use 'emailsubject' instead.\n");
- ast_copy_string(emailtitle, val, sizeof(emailtitle));
}
if ((val = ast_variable_retrieve(cfg, "general", "emailsubject")))
emailsubject = ast_strdup(val);
diff --git a/cdr/cdr_sqlite3_custom.c b/cdr/cdr_sqlite3_custom.c
index 87718db59..9352e1d4d 100644
--- a/cdr/cdr_sqlite3_custom.c
+++ b/cdr/cdr_sqlite3_custom.c
@@ -102,7 +102,7 @@ static int load_column_config(const char *tmp)
return -1;
}
if (!column_string->used)
- ast_str_set(&column_string, 0, escaped);
+ ast_str_set(&column_string, 0, "%s", escaped);
else
ast_str_append(&column_string, 0, ",%s", escaped);
sqlite3_free(escaped);
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;x<IAX_MAX_CALLS;x++) {
ast_mutex_lock(&iaxsl[x]);
if (iaxs[x]) {
int localjitter, localdelay, locallost, locallosspct, localdropped, localooo;
- char *fmt;
jb_info jbinfo;
if(ast_test_flag(iaxs[x], IAX_USEJITTERBUF)) {
@@ -5196,13 +5197,9 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt)
localdropped = 0;
localooo = -1;
}
- if (limit_fmt)
- fmt = "%-25.25s %4d %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d\n";
- else
- fmt = "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n";
if (s)
- astman_append(s, fmt,
+ astman_append(s, limit_fmt ? ACN_FORMAT1 : ACN_FORMAT2,
iaxs[x]->owner ? 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,
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index f94f2527b..a2b800c87 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -5709,7 +5709,7 @@ void chan_misdn_log(int level, int port, char *tmpl, ...)
va_end(ap);
if (level == -1)
- ast_log(LOG_WARNING, buf);
+ ast_log(LOG_WARNING, "%s", buf);
else if (misdn_debug_only[port] ?
(level == 1 && misdn_debug[port]) || (level == misdn_debug[port])
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5a7353b85..512cab3ce 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2623,7 +2623,7 @@ static void ast_sip_ouraddrfor(struct in_addr *them, struct sockaddr_in *us)
}
/*! \brief Append to SIP dialog history with arg list */
-static void append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
+static __attribute__((format (printf, 2, 0))) void append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
{
char buf[80], *c = buf; /* max history length */
struct sip_history *hist;
diff --git a/funcs/func_enum.c b/funcs/func_enum.c
index a60b748a7..e1c29cbfc 100644
--- a/funcs/func_enum.c
+++ b/funcs/func_enum.c
@@ -67,14 +67,14 @@ static int function_enum(struct ast_channel *chan, const char *cmd, char *data,
buf[0] = '\0';
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, synopsis);
+ ast_log(LOG_WARNING, "%s", synopsis);
return -1;
}
AST_STANDARD_APP_ARGS(args, data);
if (args.argc < 1) {
- ast_log(LOG_WARNING, synopsis);
+ ast_log(LOG_WARNING, "%s", synopsis);
return -1;
}
diff --git a/include/asterisk/astobj.h b/include/asterisk/astobj.h
index cca463f42..1d302d38a 100644
--- a/include/asterisk/astobj.h
+++ b/include/asterisk/astobj.h
@@ -810,7 +810,7 @@ extern "C" {
* descriptor.
*/
#define ASTOBJ_CONTAINER_DUMP(fd,s,slen,container) \
- ASTOBJ_CONTAINER_TRAVERSE(container, 1, do { ASTOBJ_DUMP(s,slen,iterator); ast_cli(fd, s); } while(0))
+ ASTOBJ_CONTAINER_TRAVERSE(container, 1, do { ASTOBJ_DUMP(s,slen,iterator); ast_cli(fd, "%s", s); } while(0))
#if defined(__cplusplus) || defined(c_plusplus)
}
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 2c49cc054..226c7bb67 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -218,7 +218,7 @@ int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attri
\param fmt printf-style format string
\param ap varargs list of arguments for format
*/
-int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap);
+int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap) __attribute__((format (printf, 3, 0)));
/*!
* \brief Make sure something is true.
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index a9c8d5f0c..be7d3fbfd 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -554,6 +554,7 @@ char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *fi
_ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
AST_INLINE_API(
+__attribute__((format (printf, 5, 6)))
int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...),
{
int res;
@@ -580,6 +581,7 @@ int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, co
_ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
AST_INLINE_API(
+__attribute__((format (printf, 5, 0)))
int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
{
int res;
diff --git a/include/jitterbuf.h b/include/jitterbuf.h
index 2a6045f05..00f26e21c 100644
--- a/include/jitterbuf.h
+++ b/include/jitterbuf.h
@@ -163,7 +163,7 @@ enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats);
/*! \brief set jitterbuf conf */
enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf);
-typedef void (*jb_output_function_t)(const char *fmt, ...);
+typedef void __attribute__((format (printf, 1, 2))) (*jb_output_function_t)(const char *fmt, ...);
void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
#ifdef __cplusplus
diff --git a/main/asterisk.c b/main/asterisk.c
index 32bb644f7..04b5ccb38 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1373,7 +1373,7 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
close(ast_consock);
if (!ast_opt_remote)
unlink(ast_config_AST_PID);
- printf(term_quit());
+ printf("%s", term_quit());
if (restart) {
if (option_verbose || ast_opt_console)
ast_verbose("Preparing for Asterisk restart...\n");
@@ -1458,7 +1458,7 @@ static int ast_all_zeros(char *s)
static void consolehandler(char *s)
{
- printf(term_end());
+ printf("%s", term_end());
fflush(stdout);
/* Called when readline data is available */
@@ -1906,7 +1906,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
for (tries = 0; tries < 30 * reconnects_per_second; tries++) {
if (ast_tryconnect()) {
fprintf(stderr, "Reconnect succeeded after %.3f seconds\n", 1.0 / reconnects_per_second * tries);
- printf(term_quit());
+ printf("%s", term_quit());
WELCOME_MESSAGE;
if (!ast_opt_mute)
fdprint(ast_consock, "logger mute silent");
@@ -3086,7 +3086,7 @@ int main(int argc, char *argv[])
#endif
ast_term_init();
- printf(term_end());
+ printf("%s", term_end());
fflush(stdout);
if (ast_opt_console && !option_verbose)
@@ -3111,18 +3111,18 @@ int main(int argc, char *argv[])
quit_handler(0, 0, 0, 0);
exit(0);
}
- printf(term_quit());
+ printf("%s", term_quit());
ast_remotecontrol(NULL);
quit_handler(0, 0, 0, 0);
exit(0);
} else {
ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET);
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
} else if (ast_opt_remote || ast_opt_exec) {
ast_log(LOG_ERROR, "Unable to connect to remote asterisk (does %s exist?)\n", ast_config_AST_SOCKET);
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
/* Blindly write pid file since we couldn't connect */
@@ -3180,7 +3180,7 @@ int main(int argc, char *argv[])
initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool));
if (init_logger()) { /* Start logging subsystem */
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
@@ -3191,12 +3191,12 @@ int main(int argc, char *argv[])
ast_autoservice_init();
if (load_modules(1)) { /* Load modules, pre-load only */
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (dnsmgr_init()) { /* Initialize the DNS manager */
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
@@ -3205,17 +3205,17 @@ int main(int argc, char *argv[])
ast_channels_init();
if (init_manager()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (ast_cdr_engine_init()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (ast_device_state_engine_init()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
@@ -3224,39 +3224,39 @@ int main(int argc, char *argv[])
ast_udptl_init();
if (ast_image_init()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (ast_file_init()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (load_pbx()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
ast_features_init();
if (init_framer()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (astdb_init()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (ast_enum_init()) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
if (load_modules(0)) {
- printf(term_quit());
+ printf("%s", term_quit());
exit(1);
}
@@ -3267,7 +3267,7 @@ int main(int argc, char *argv[])
if (ast_opt_console && !option_verbose)
ast_verbose(" ]\n");
if (option_verbose || ast_opt_console)
- ast_verbose(term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
+ ast_verbose("%s", term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
if (ast_opt_no_fork)
consolethread = pthread_self();
diff --git a/main/cli.c b/main/cli.c
index 07ad7bcc6..11d6671d8 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -878,7 +878,7 @@ static char *handle_commandcomplete(struct ast_cli_entry *e, int cmd, struct ast
return CLI_SHOWUSAGE;
buf = __ast_cli_generator(a->argv[2], a->argv[3], atoi(a->argv[4]), 0);
if (buf) {
- ast_cli(a->fd, buf);
+ ast_cli(a->fd, "%s", buf);
ast_free(buf);
} else
ast_cli(a->fd, "NULL\n");
diff --git a/main/features.c b/main/features.c
index ff3ef50e7..0773ef4ba 100644
--- a/main/features.c
+++ b/main/features.c
@@ -2850,7 +2850,7 @@ static char *handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cl
{
int i;
struct ast_call_feature *feature;
- char format[] = "%-25s %-7s %-7s\n";
+#define HFS_FORMAT "%-25s %-7s %-7s\n"
switch (cmd) {
@@ -2864,25 +2864,25 @@ static char *handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cl
return NULL;
}
- ast_cli(a->fd, format, "Builtin Feature", "Default", "Current");
- ast_cli(a->fd, format, "---------------", "-------", "-------");
+ ast_cli(a->fd, HFS_FORMAT, "Builtin Feature", "Default", "Current");
+ ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
- ast_cli(a->fd, format, "Pickup", "*8", ast_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
+ ast_cli(a->fd, HFS_FORMAT, "Pickup", "*8", ast_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
ast_rwlock_rdlock(&features_lock);
for (i = 0; i < FEATURES_COUNT; i++)
- ast_cli(a->fd, format, builtin_features[i].fname, builtin_features[i].default_exten, builtin_features[i].exten);
+ ast_cli(a->fd, HFS_FORMAT, builtin_features[i].fname, builtin_features[i].default_exten, builtin_features[i].exten);
ast_rwlock_unlock(&features_lock);
ast_cli(a->fd, "\n");
- ast_cli(a->fd, format, "Dynamic Feature", "Default", "Current");
- ast_cli(a->fd, format, "---------------", "-------", "-------");
+ ast_cli(a->fd, HFS_FORMAT, "Dynamic Feature", "Default", "Current");
+ ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
if (AST_LIST_EMPTY(&feature_list))
ast_cli(a->fd, "(none)\n");
else {
AST_LIST_LOCK(&feature_list);
AST_LIST_TRAVERSE(&feature_list, feature, feature_entry)
- ast_cli(a->fd, format, feature->sname, "no def", feature->exten);
+ ast_cli(a->fd, HFS_FORMAT, feature->sname, "no def", feature->exten);
AST_LIST_UNLOCK(&feature_list);
}
ast_cli(a->fd, "\nCall parking\n");
diff --git a/main/jitterbuf.c b/main/jitterbuf.c
index a7f3b2cd9..d8297a0a8 100644
--- a/main/jitterbuf.c
+++ b/main/jitterbuf.c
@@ -560,7 +560,7 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
/* if a hard clamp was requested, use it */
if ((jb->info.conf.max_jitterbuf) && ((jb->info.target - jb->info.min) > jb->info.conf.max_jitterbuf)) {
- jb_dbg("clamping target from %d to %d\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
+ jb_dbg("clamping target from %ld to %ld\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
jb->info.target = jb->info.min + jb->info.conf.max_jitterbuf;
}
diff --git a/main/manager.c b/main/manager.c
index 3633c131a..b4e6cb0be 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -643,7 +643,7 @@ static char *handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli
{
struct manager_action *cur;
struct ast_str *authority;
- static const char *format = " %-15.15s %-15.15s %-55.55s\n";
+#define HSMC_FORMAT " %-15.15s %-15.15s %-55.55s\n"
switch (cmd) {
case CLI_INIT:
e->command = "manager show commands";
@@ -655,12 +655,12 @@ static char *handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli
return NULL;
}
authority = ast_str_alloca(80);
- ast_cli(a->fd, format, "Action", "Privilege", "Synopsis");
- ast_cli(a->fd, format, "------", "---------", "--------");
+ ast_cli(a->fd, HSMC_FORMAT, "Action", "Privilege", "Synopsis");
+ ast_cli(a->fd, HSMC_FORMAT, "------", "---------", "--------");
AST_RWLIST_RDLOCK(&actions);
AST_RWLIST_TRAVERSE(&actions, cur, list)
- ast_cli(a->fd, format, cur->action, authority_to_str(cur->authority, &authority), cur->synopsis);
+ ast_cli(a->fd, HSMC_FORMAT, cur->action, authority_to_str(cur->authority, &authority), cur->synopsis);
AST_RWLIST_UNLOCK(&actions);
return CLI_SUCCESS;
@@ -671,8 +671,8 @@ static char *handle_showmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli
{
struct mansession *s;
time_t now = time(NULL);
- static const char *format = " %-15.15s %-15.15s %-10.10s %-10.10s %-8.8s %-8.8s %-5.5s %-5.5s\n";
- static const char *format2 = " %-15.15s %-15.15s %-10d %-10d %-8d %-8d %-5.5d %-5.5d\n";
+#define HSMCONN_FORMAT1 " %-15.15s %-15.15s %-10.10s %-10.10s %-8.8s %-8.8s %-5.5s %-5.5s\n"
+#define HSMCONN_FORMAT2 " %-15.15s %-15.15s %-10d %-10d %-8d %-8d %-5.5d %-5.5d\n"
int count = 0;
switch (cmd) {
case CLI_INIT:
@@ -686,11 +686,11 @@ static char *handle_showmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli
return NULL;
}
- ast_cli(a->fd, format, "Username", "IP Address", "Start", "Elapsed", "FileDes", "HttpCnt", "Read", "Write");
+ ast_cli(a->fd, HSMCONN_FORMAT1, "Username", "IP Address", "Start", "Elapsed", "FileDes", "HttpCnt", "Read", "Write");
AST_LIST_LOCK(&sessions);
AST_LIST_TRAVERSE(&sessions, s, list) {
- ast_cli(a->fd, format2, s->username, ast_inet_ntoa(s->sin.sin_addr), (int)(s->sessionstart), (int)(now - s->sessionstart), s->fd, s->inuse, s->readperm, s->writeperm);
+ ast_cli(a->fd, HSMCONN_FORMAT2, s->username, ast_inet_ntoa(s->sin.sin_addr), (int)(s->sessionstart), (int)(now - s->sessionstart), s->fd, s->inuse, s->readperm, s->writeperm);
count++;
}
AST_LIST_UNLOCK(&sessions);
@@ -3520,7 +3520,7 @@ static struct ast_str *generic_http_callback(enum output_format format,
if (format == FORMAT_XML || format == FORMAT_HTML)
xml_translate(&out, buf, params, format);
else
- ast_str_append(&out, 0, buf);
+ ast_str_append(&out, 0, "%s", buf);
munmap(buf, l);
}
} else if (format == FORMAT_XML || format == FORMAT_HTML) {
diff --git a/main/translate.c b/main/translate.c
index be10b11b2..750b2f5b6 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -592,7 +592,7 @@ static char *handle_cli_core_show_translation(struct ast_cli_entry *e, int cmd,
}
}
ast_str_append(&out, -1, "\n");
- ast_cli(a->fd, out->str);
+ ast_cli(a->fd, "%s", out->str);
}
AST_RWLIST_UNLOCK(&translators);
return CLI_SUCCESS;
diff --git a/main/utils.c b/main/utils.c
index c3edcd626..b4a7d3279 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -1349,6 +1349,7 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
return result;
}
+__attribute((format (printf, 4, 0)))
void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
struct ast_string_field_pool **pool_head,
const ast_string_field *ptr, const char *format, va_list ap1, va_list ap2)
@@ -1380,6 +1381,7 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
mgr->used += needed;
}
+__attribute((format (printf, 4, 5)))
void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr,
struct ast_string_field_pool **pool_head,
const ast_string_field *ptr, const char *format, ...)
@@ -1470,6 +1472,8 @@ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
* ast_str_set_va(...)
* ast_str_append_va(...)
*/
+
+__attribute__((format (printf, 4, 0)))
int __ast_str_helper(struct ast_str **buf, size_t max_len,
int append, const char *fmt, va_list ap)
{
diff --git a/res/res_agi.c b/res/res_agi.c
index 47bfeb077..59e79ce6f 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -2721,7 +2721,7 @@ static char *handle_cli_agi_show(struct ast_cli_entry *e, int cmd, struct ast_cl
if (a->argc > e->args) {
command = find_command(a->argv + e->args, 1);
if (command) {
- ast_cli(a->fd, command->usage);
+ ast_cli(a->fd, "%s", command->usage);
ast_cli(a->fd, " Runs Dead : %s\n", command->dead ? "Yes" : "No");
} else {
if (find_command(a->argv + e->args, -1)) {
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index b76ad8ae7..028902adb 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -766,10 +766,10 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
ast_str_append(&filter, 0, "(&");
if (table_config && table_config->additional_filter)
- ast_str_append(&filter, 0, table_config->additional_filter);
+ ast_str_append(&filter, 0, "%s", table_config->additional_filter);
if (table_config != base_table_config && base_table_config &&
base_table_config->additional_filter) {
- ast_str_append(&filter, 0, base_table_config->additional_filter);
+ ast_str_append(&filter, 0, "%s", base_table_config->additional_filter);
}
/* Create the first part of the query using the first parameter/value pairs we just extracted */
@@ -1171,11 +1171,11 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
/* Create the filter with the table additional filter and the parameter/value pairs we were given */
ast_str_append(&filter, 0, "(&");
if (table_config && table_config->additional_filter) {
- ast_str_append(&filter, 0, table_config->additional_filter);
+ ast_str_append(&filter, 0, "%s", table_config->additional_filter);
}
if (table_config != base_table_config && base_table_config
&& base_table_config->additional_filter) {
- ast_str_append(&filter, 0, base_table_config->additional_filter);
+ ast_str_append(&filter, 0, "%s", base_table_config->additional_filter);
}
append_var_and_value_to_filter(&filter, table_config, attribute, lookup);
ast_str_append(&filter, 0, ")");
diff --git a/res/res_indications.c b/res/res_indications.c
index a957b7828..af56444cd 100644
--- a/res/res_indications.c
+++ b/res/res_indications.c
@@ -202,7 +202,7 @@ static char *handle_cli_indication_show(struct ast_cli_entry *e, int cmd, struct
if (tz->nrringcadence)
j--;
ast_copy_string(buf + j, "\n", sizeof(buf) - j);
- ast_cli(a->fd, buf);
+ ast_cli(a->fd, "%s", buf);
for (ts = tz->tones; ts; ts = ts->next)
ast_cli(a->fd, "%-7.7s %-15.15s %s\n", tz->country, ts->name, ts->data);
break;
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index f7bcd5ab5..f5d785643 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -914,7 +914,7 @@ static int pp_each_user_exec(struct ast_channel *chan, const char *cmd, char *da
if (!ast_strlen_zero(args.exclude_mac) && !strcasecmp(user->macaddress, args.exclude_mac))
continue;
pbx_substitute_variables_varshead(user->headp, args.string, expand_buf, sizeof(expand_buf));
- ast_build_string(&buf, &len, expand_buf);
+ ast_build_string(&buf, &len, "%s", expand_buf);
}
AST_RWLIST_UNLOCK(&users);
diff --git a/res/res_realtime.c b/res/res_realtime.c
index 14ad28c40..297ecb5ba 100644
--- a/res/res_realtime.c
+++ b/res/res_realtime.c
@@ -42,7 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- char *header_format = "%30s %-30s\n";
+#define CRL_HEADER_FORMAT "%30s %-30s\n"
struct ast_variable *var=NULL;
switch (cmd) {
@@ -64,10 +64,10 @@ static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_
var = ast_load_realtime_all(a->argv[2], a->argv[3], a->argv[4], NULL);
if (var) {
- ast_cli(a->fd, header_format, "Column Name", "Column Value");
- ast_cli(a->fd, header_format, "--------------------", "--------------------");
+ ast_cli(a->fd, CRL_HEADER_FORMAT, "Column Name", "Column Value");
+ ast_cli(a->fd, CRL_HEADER_FORMAT, "--------------------", "--------------------");
while (var) {
- ast_cli(a->fd, header_format, var->name, var->value);
+ ast_cli(a->fd, CRL_HEADER_FORMAT, var->name, var->value);
var = var->next;
}
} else {
diff --git a/utils/astman.c b/utils/astman.c
index 06fe8b3ad..2a4508589 100644
--- a/utils/astman.c
+++ b/utils/astman.c
@@ -141,7 +141,8 @@ static void del_chan(char *name)
AST_LIST_TRAVERSE_SAFE_END;
}
-static void fdprintf(int fd, char *fmt, ...)
+
+static void __attribute__((format (printf, 2, 3))) fdprintf(int fd, char *fmt, ...)
{
char stuff[4096];
va_list ap;
@@ -406,7 +407,8 @@ static struct message *wait_for_response(int timeout)
return NULL;
}
-static int manager_action(char *action, char *fmt, ...)
+
+static int __attribute__((format (printf, 2, 3))) manager_action(char *action, char *fmt, ...)
{
struct ast_mansession *s;
char tmp[4096];
@@ -465,7 +467,7 @@ static int hide_doing(void)
static void try_status(void)
{
struct message *m;
- manager_action("Status", "");
+ manager_action("Status", "%s", "");
m = wait_for_response(10000);
if (!m) {
show_message("Status Failed", "Timeout waiting for response");
diff --git a/utils/check_expr.c b/utils/check_expr.c
index 009fe8673..260fd4e2e 100644
--- a/utils/check_expr.c
+++ b/utils/check_expr.c
@@ -40,7 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
* ast_str_set_va(...)
* ast_str_append_va(...)
*/
-int __ast_str_helper(struct ast_str **buf, size_t max_len,
+int __attribute__((format (printf, 4, 0))) __ast_str_helper(struct ast_str **buf, size_t max_len,
int append, const char *fmt, va_list ap)
{
int res, need;
diff --git a/utils/extconf.c b/utils/extconf.c
index 5d4b21eac..84b3fb546 100644
--- a/utils/extconf.c
+++ b/utils/extconf.c
@@ -338,6 +338,7 @@ char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *fi
_ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
AST_INLINE_API(
+__attribute__((format (printf, 5, 6)))
int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...),
{
int res;
@@ -364,6 +365,7 @@ int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, co
_ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
AST_INLINE_API(
+__attribute__((format (printf, 5, 0)))
int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
{
int res;
@@ -2729,7 +2731,7 @@ static void ast_log(int level, const char *file, int line, const char *function,
va_end(vars);
}
-static void ast_verbose(const char *fmt, ...)
+static void __attribute__((format (printf, 1, 2))) ast_verbose(const char *fmt, ...)
{
va_list vars;
va_start(vars,fmt);
diff --git a/utils/frame.c b/utils/frame.c
index 7fdb1637d..5aadb9687 100644
--- a/utils/frame.c
+++ b/utils/frame.c
@@ -910,7 +910,7 @@ int workloop( FILE *theinfile, FILE *theoutfile,
return TRUE; /* Input file done with, no errors. */
}
-int chat( const char *format, ...)
+int __attribute__((format (printf,1,2))) chat( const char *format, ...)
{
va_list ap;
int result = 0;
@@ -924,8 +924,7 @@ int chat( const char *format, ...)
return result;
}
-
-int inform( const char *format, ...)
+int __attribute__((format (printf,1,2))) inform( const char *format, ...)
{
va_list ap;
int result = 0;
@@ -939,7 +938,7 @@ int inform( const char *format, ...)
return result;
}
-int error( const char *format, ...)
+int __attribute__((format (printf,1,2))) error( const char *format, ...)
{
va_list ap;
int result;
@@ -950,7 +949,7 @@ int error( const char *format, ...)
return result;
}
-void fatalerror( const char *format, ...)
+void __attribute__((format (printf,1,2))) fatalerror( const char *format, ...)
{
va_list ap;
@@ -966,7 +965,7 @@ void fatalperror( const char *string)
myexit( 1);
}
-int say( const char *format, ...)
+int __attribute__((format (printf,1,2))) say( const char *format, ...)
{
va_list ap;
int result;