[svn-commits] russell: branch 1.6.0 r109459 - in /branches/1.6.0: ./ apps/ cdr/ channels/ f...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Mar 18 10:58:51 CDT 2008
Author: russell
Date: Tue Mar 18 10:58:50 2008
New Revision: 109459
URL: http://svn.digium.com/view/asterisk?view=rev&rev=109459
Log:
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.
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/Makefile
branches/1.6.0/apps/app_festival.c
branches/1.6.0/apps/app_meetme.c
branches/1.6.0/apps/app_minivm.c
branches/1.6.0/apps/app_queue.c
branches/1.6.0/apps/app_voicemail.c
branches/1.6.0/cdr/cdr_sqlite3_custom.c
branches/1.6.0/channels/chan_iax2.c
branches/1.6.0/channels/chan_misdn.c
branches/1.6.0/channels/chan_sip.c
branches/1.6.0/funcs/func_enum.c
branches/1.6.0/include/asterisk/astobj.h
branches/1.6.0/include/asterisk/strings.h
branches/1.6.0/include/asterisk/utils.h
branches/1.6.0/include/jitterbuf.h
branches/1.6.0/main/asterisk.c
branches/1.6.0/main/cli.c
branches/1.6.0/main/features.c
branches/1.6.0/main/jitterbuf.c
branches/1.6.0/main/manager.c
branches/1.6.0/main/translate.c
branches/1.6.0/main/utils.c
branches/1.6.0/res/res_agi.c
branches/1.6.0/res/res_config_ldap.c
branches/1.6.0/res/res_indications.c
branches/1.6.0/res/res_phoneprov.c
branches/1.6.0/res/res_realtime.c
branches/1.6.0/utils/astman.c
branches/1.6.0/utils/check_expr.c
branches/1.6.0/utils/extconf.c
branches/1.6.0/utils/frame.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/Makefile?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/Makefile (original)
+++ branches/1.6.0/Makefile Tue Mar 18 10:58:50 2008
@@ -229,7 +229,7 @@
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)),)
Modified: branches/1.6.0/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_festival.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/apps/app_festival.c (original)
+++ branches/1.6.0/apps/app_festival.c Tue Mar 18 10:58:50 2008
@@ -327,11 +327,21 @@
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 @@
} 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 @@
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 @@
} 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);
}
Modified: branches/1.6.0/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_meetme.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/apps/app_meetme.c (original)
+++ branches/1.6.0/apps/app_meetme.c Tue Mar 18 10:58:50 2008
@@ -955,9 +955,9 @@
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 @@
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 @@
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,
Modified: branches/1.6.0/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_minivm.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/apps/app_minivm.c (original)
+++ branches/1.6.0/apps/app_minivm.c Tue Mar 18 10:58:50 2008
@@ -1560,10 +1560,10 @@
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 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 @@
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 *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 @@
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_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 @@
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");
Modified: branches/1.6.0/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Tue Mar 18 10:58:50 2008
@@ -1233,13 +1233,13 @@
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);
Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Tue Mar 18 10:58:50 2008
@@ -645,7 +645,6 @@
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 @@
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 *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 @@
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 @@
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 @@
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_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 @@
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 @@
}
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 @@
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);
Modified: branches/1.6.0/cdr/cdr_sqlite3_custom.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/cdr/cdr_sqlite3_custom.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/cdr/cdr_sqlite3_custom.c (original)
+++ branches/1.6.0/cdr/cdr_sqlite3_custom.c Tue Mar 18 10:58:50 2008
@@ -102,7 +102,7 @@
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);
Modified: branches/1.6.0/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_iax2.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/channels/chan_iax2.c (original)
+++ branches/1.6.0/channels/chan_iax2.c Tue Mar 18 10:58:50 2008
@@ -788,7 +788,7 @@
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 @@
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
- ast_log(LOG_ERROR, buf);
-}
-
-static void jb_warning_output(const char *fmt, ...)
+ ast_log(LOG_ERROR, "%s", buf);
+}
+
+static void __attribute__((format (printf, 1, 2))) jb_warning_output(const char *fmt, ...)
{
va_list args;
char buf[1024];
@@ -809,10 +809,10 @@
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
- ast_log(LOG_WARNING, buf);
-}
-
-static void jb_debug_output(const char *fmt, ...)
+ ast_log(LOG_WARNING, "%s", buf);
+}
+
+static void __attribute__((format (printf, 1, 2))) jb_debug_output(const char *fmt, ...)
{
va_list args;
char buf[1024];
@@ -821,7 +821,7 @@
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
- ast_verbose(buf);
+ ast_verbose("%s", buf);
}
/*!
@@ -5173,11 +5173,12 @@
{
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 @@
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 @@
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,
Modified: branches/1.6.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_misdn.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/channels/chan_misdn.c (original)
+++ branches/1.6.0/channels/chan_misdn.c Tue Mar 18 10:58:50 2008
@@ -5709,7 +5709,7 @@
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])
Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Tue Mar 18 10:58:50 2008
@@ -2623,7 +2623,7 @@
}
/*! \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;
Modified: branches/1.6.0/funcs/func_enum.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/funcs/func_enum.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/funcs/func_enum.c (original)
+++ branches/1.6.0/funcs/func_enum.c Tue Mar 18 10:58:50 2008
@@ -67,14 +67,14 @@
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;
}
Modified: branches/1.6.0/include/asterisk/astobj.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/astobj.h?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/include/asterisk/astobj.h (original)
+++ branches/1.6.0/include/asterisk/astobj.h Tue Mar 18 10:58:50 2008
@@ -810,7 +810,7 @@
* 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)
}
Modified: branches/1.6.0/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/strings.h?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/include/asterisk/strings.h (original)
+++ branches/1.6.0/include/asterisk/strings.h Tue Mar 18 10:58:50 2008
@@ -218,7 +218,7 @@
\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.
Modified: branches/1.6.0/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/utils.h?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/include/asterisk/utils.h (original)
+++ branches/1.6.0/include/asterisk/utils.h Tue Mar 18 10:58:50 2008
@@ -554,6 +554,7 @@
_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 @@
_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;
Modified: branches/1.6.0/include/jitterbuf.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/jitterbuf.h?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/include/jitterbuf.h (original)
+++ branches/1.6.0/include/jitterbuf.h Tue Mar 18 10:58:50 2008
@@ -163,7 +163,7 @@
/*! \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
Modified: branches/1.6.0/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/asterisk.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/main/asterisk.c (original)
+++ branches/1.6.0/main/asterisk.c Tue Mar 18 10:58:50 2008
@@ -1373,7 +1373,7 @@
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 void consolehandler(char *s)
{
- printf(term_end());
+ printf("%s", term_end());
fflush(stdout);
/* Called when readline data is available */
@@ -1906,7 +1906,7 @@
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 @@
#endif
ast_term_init();
- printf(term_end());
+ printf("%s", term_end());
fflush(stdout);
if (ast_opt_console && !option_verbose)
@@ -3111,18 +3111,18 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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();
Modified: branches/1.6.0/main/cli.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/cli.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/main/cli.c (original)
+++ branches/1.6.0/main/cli.c Tue Mar 18 10:58:50 2008
@@ -878,7 +878,7 @@
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");
Modified: branches/1.6.0/main/features.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/features.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/main/features.c (original)
+++ branches/1.6.0/main/features.c Tue Mar 18 10:58:50 2008
@@ -2850,7 +2850,7 @@
{
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 @@
return NULL;
}
- ast_cli(a->fd, format, "Builtin Feature", "Default", "Current");
- ast_cli(a->fd, 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, "Builtin Feature", "Default", "Current");
+ ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
+
+ 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");
Modified: branches/1.6.0/main/jitterbuf.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/jitterbuf.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/main/jitterbuf.c (original)
+++ branches/1.6.0/main/jitterbuf.c Tue Mar 18 10:58:50 2008
@@ -560,7 +560,7 @@
/* 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;
}
Modified: branches/1.6.0/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/manager.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/main/manager.c (original)
+++ branches/1.6.0/main/manager.c Tue Mar 18 10:58:50 2008
@@ -643,7 +643,7 @@
{
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 @@
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 @@
{
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 @@
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 @@
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) {
Modified: branches/1.6.0/main/translate.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/translate.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/main/translate.c (original)
+++ branches/1.6.0/main/translate.c Tue Mar 18 10:58:50 2008
@@ -592,7 +592,7 @@
}
}
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;
Modified: branches/1.6.0/main/utils.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/utils.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/main/utils.c (original)
+++ branches/1.6.0/main/utils.c Tue Mar 18 10:58:50 2008
@@ -1349,6 +1349,7 @@
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 @@
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 @@
* 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)
{
Modified: branches/1.6.0/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_agi.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/res/res_agi.c (original)
+++ branches/1.6.0/res/res_agi.c Tue Mar 18 10:58:50 2008
@@ -2721,7 +2721,7 @@
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)) {
Modified: branches/1.6.0/res/res_config_ldap.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_config_ldap.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/res/res_config_ldap.c (original)
+++ branches/1.6.0/res/res_config_ldap.c Tue Mar 18 10:58:50 2008
@@ -766,10 +766,10 @@
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 @@
/* 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, ")");
Modified: branches/1.6.0/res/res_indications.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_indications.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/res/res_indications.c (original)
+++ branches/1.6.0/res/res_indications.c Tue Mar 18 10:58:50 2008
@@ -202,7 +202,7 @@
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;
Modified: branches/1.6.0/res/res_phoneprov.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_phoneprov.c?view=diff&rev=109459&r1=109458&r2=109459
==============================================================================
--- branches/1.6.0/res/res_phoneprov.c (original)
+++ branches/1.6.0/res/res_phoneprov.c Tue Mar 18 10:58:50 2008
@@ -914,7 +914,7 @@
if (!ast_strlen_zero(args.exclude_mac) && !strcasecmp(user->macaddress, args.exclude_mac))
continue;
[... 169 lines stripped ...]
More information about the svn-commits
mailing list