aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 21:28:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 21:28:06 +0000
commit5f4f6a16c6f8445c03929d005d1b54d7e33e2a0b (patch)
treef569ed2f6bd68574ed062e0071f7b162f71fe631
parent2afe39172fa21bff7deb93028e6fca050e6757e3 (diff)
Changes for 1.6.0.12v1.6.0.12
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.0.12@211672 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--.version2
-rw-r--r--ChangeLog6
-rw-r--r--agi/eagi-sphinx-test.c2
-rw-r--r--agi/eagi-test.c2
-rw-r--r--apps/app_adsiprog.c6
-rw-r--r--apps/app_alarmreceiver.c2
-rw-r--r--apps/app_chanspy.c4
-rw-r--r--apps/app_dahdibarge.c6
-rw-r--r--apps/app_disa.c4
-rw-r--r--apps/app_followme.c2
-rw-r--r--apps/app_macro.c8
-rw-r--r--apps/app_meetme.c28
-rw-r--r--apps/app_minivm.c8
-rw-r--r--apps/app_mixmonitor.c6
-rw-r--r--apps/app_morsecode.c4
-rw-r--r--apps/app_osplookup.c34
-rw-r--r--apps/app_privacy.c4
-rw-r--r--apps/app_queue.c12
-rw-r--r--apps/app_readfile.c2
-rw-r--r--apps/app_record.c4
-rw-r--r--apps/app_rpt.c18
-rw-r--r--apps/app_setcallerid.c2
-rw-r--r--apps/app_sms.c10
-rw-r--r--apps/app_stack.c2
-rw-r--r--apps/app_talkdetect.c6
-rw-r--r--apps/app_verbose.c2
-rw-r--r--apps/app_voicemail.c40
-rw-r--r--apps/app_waitforring.c2
-rw-r--r--apps/app_waitforsilence.c6
-rw-r--r--apps/app_waituntil.c2
-rw-r--r--asterisk-1.6.0.10-summary.html84
-rw-r--r--asterisk-1.6.0.10-summary.txt125
-rw-r--r--asterisk-1.6.0.9-summary.html110
-rw-r--r--asterisk-1.6.0.9-summary.txt152
-rw-r--r--cdr/cdr_adaptive_odbc.c20
-rw-r--r--cdr/cdr_pgsql.c6
-rw-r--r--channels/chan_agent.c8
-rw-r--r--channels/chan_dahdi.c42
-rw-r--r--channels/chan_iax2.c8
-rw-r--r--channels/chan_mgcp.c14
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_oss.c2
-rw-r--r--channels/chan_phone.c2
-rw-r--r--channels/chan_sip.c137
-rw-r--r--channels/chan_skinny.c2
-rw-r--r--channels/chan_usbradio.c10
-rw-r--r--channels/iax2-provision.c4
-rw-r--r--channels/misdn_config.c10
-rw-r--r--codecs/codec_speex.c8
-rw-r--r--doc/CODING-GUIDELINES12
-rw-r--r--funcs/func_channel.c4
-rw-r--r--funcs/func_cut.c10
-rw-r--r--funcs/func_dialplan.c2
-rw-r--r--funcs/func_enum.c2
-rw-r--r--funcs/func_math.c4
-rw-r--r--funcs/func_odbc.c2
-rw-r--r--funcs/func_rand.c4
-rw-r--r--funcs/func_strings.c4
-rw-r--r--main/acl.c12
-rw-r--r--main/asterisk.c26
-rw-r--r--main/cdr.c4
-rw-r--r--main/channel.c4
-rw-r--r--main/cli.c2
-rw-r--r--main/config.c2
-rw-r--r--main/dnsmgr.c2
-rw-r--r--main/features.c18
-rw-r--r--main/frame.c2
-rw-r--r--main/http.c10
-rw-r--r--main/indications.c24
-rw-r--r--main/manager.c10
-rw-r--r--main/pbx.c12
-rw-r--r--main/utils.c4
-rw-r--r--pbx/dundi-parser.c6
-rw-r--r--pbx/pbx_config.c8
-rw-r--r--pbx/pbx_dundi.c18
-rw-r--r--pbx/pbx_loopback.c2
-rw-r--r--pbx/pbx_spool.c10
-rw-r--r--res/ael/pval.c8
-rw-r--r--res/res_agi.c24
-rw-r--r--res/res_config_curl.c6
-rw-r--r--res/res_config_ldap.c4
-rw-r--r--res/res_limit.c2
-rw-r--r--res/res_musiconhold.c2
-rw-r--r--res/res_odbc.c8
-rw-r--r--res/res_smdi.c8
-rw-r--r--res/snmp/agent.c2
-rw-r--r--utils/extconf.c10
-rw-r--r--utils/frame.c12
-rw-r--r--utils/muted.c4
89 files changed, 431 insertions, 861 deletions
diff --git a/.version b/.version
index db090f665..2fb4772b5 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-1.6.0.10
+1.6.0.12
diff --git a/ChangeLog b/ChangeLog
index d77a5801b..35dbadcc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-09 Tilghman Lesher <tlesher@digium.com>
+
+ * Asterisk 1.6.0.12 released
+
+ * AST-2009-005
+
2009-06-05 Leif Madsen <lmadsen@digium.com>
* Asterisk 1.6.0.10 released
diff --git a/agi/eagi-sphinx-test.c b/agi/eagi-sphinx-test.c
index 4d13db507..359360286 100644
--- a/agi/eagi-sphinx-test.c
+++ b/agi/eagi-sphinx-test.c
@@ -223,7 +223,7 @@ int main(int argc, char *argv[])
connect_sphinx();
tmp = getenv("agi_enhanced");
if (tmp) {
- if (sscanf(tmp, "%d.%d", &ver, &subver) != 2)
+ if (sscanf(tmp, "%30d.%30d", &ver, &subver) != 2)
ver = 0;
}
if (ver < 1) {
diff --git a/agi/eagi-test.c b/agi/eagi-test.c
index c40b85d1e..dc2d7fa1a 100644
--- a/agi/eagi-test.c
+++ b/agi/eagi-test.c
@@ -156,7 +156,7 @@ int main(int argc, char *argv[])
}
tmp = getenv("agi_enhanced");
if (tmp) {
- if (sscanf(tmp, "%d.%d", &ver, &subver) != 2)
+ if (sscanf(tmp, "%30d.%30d", &ver, &subver) != 2)
ver = 0;
}
if (ver < 1) {
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c
index 0a22cae41..0292c2038 100644
--- a/apps/app_adsiprog.c
+++ b/apps/app_adsiprog.c
@@ -187,7 +187,7 @@ static int process_token(void *out, char *src, int maxlen, int argtype)
if (!(argtype & ARG_NUMBER))
return -1;
/* Octal value */
- if (sscanf(src, "%o", (int *)out) != 1)
+ if (sscanf(src, "%30o", (int *)out) != 1)
return -1;
if (argtype & ARG_STRING) {
/* Convert */
@@ -197,7 +197,7 @@ static int process_token(void *out, char *src, int maxlen, int argtype)
if (!(argtype & ARG_NUMBER))
return -1;
/* Hex value */
- if (sscanf(src + 2, "%x", (unsigned int *)out) != 1)
+ if (sscanf(src + 2, "%30x", (unsigned int *)out) != 1)
return -1;
if (argtype & ARG_STRING) {
/* Convert */
@@ -207,7 +207,7 @@ static int process_token(void *out, char *src, int maxlen, int argtype)
if (!(argtype & ARG_NUMBER))
return -1;
/* Hex value */
- if (sscanf(src, "%d", (int *)out) != 1)
+ if (sscanf(src, "%30d", (int *)out) != 1)
return -1;
if (argtype & ARG_STRING) {
/* Convert */
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c
index 45b11aca5..2cad169c4 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -115,7 +115,7 @@ static void database_increment( char *key )
return;
}
- sscanf(value, "%u", &v);
+ sscanf(value, "%30u", &v);
v++;
ast_verb(4, "AlarmReceiver: New value for %s: %u\n", key, v);
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index d897f4b08..1bb4aec1e 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -806,7 +806,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, OPTION_VOLUME) && opts[OPT_ARG_VOLUME]) {
int vol;
- if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
+ if ((sscanf(opts[OPT_ARG_VOLUME], "%30d", &vol) != 1) || (vol > 4) || (vol < -4))
ast_log(LOG_NOTICE, "Volume factor must be a number between -4 and 4\n");
else
volfactor = vol;
@@ -889,7 +889,7 @@ static int extenspy_exec(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, OPTION_VOLUME) && opts[OPT_ARG_VOLUME]) {
int vol;
- if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
+ if ((sscanf(opts[OPT_ARG_VOLUME], "%30d", &vol) != 1) || (vol > 4) || (vol < -4))
ast_log(LOG_NOTICE, "Volume factor must be a number between -4 and 4\n");
else
volfactor = vol;
diff --git a/apps/app_dahdibarge.c b/apps/app_dahdibarge.c
index 0e57f6285..3ad84e5aa 100644
--- a/apps/app_dahdibarge.c
+++ b/apps/app_dahdibarge.c
@@ -259,8 +259,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
char confstr[80] = "";
if (!ast_strlen_zero(data)) {
- if ((sscanf(data, "DAHDI/%d", &confno) != 1) &&
- (sscanf(data, "%d", &confno) != 1)) {
+ if ((sscanf(data, "DAHDI/%30d", &confno) != 1) &&
+ (sscanf(data, "%30d", &confno) != 1)) {
ast_log(LOG_WARNING, "DAHDIBarge Argument (if specified) must be a channel number, not '%s'\n", (char *)data);
return 0;
}
@@ -274,7 +274,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
confstr[0] = '\0';
res = ast_app_getdata(chan, "conf-getchannel",confstr, sizeof(confstr) - 1, 0);
if (res <0) goto out;
- if (sscanf(confstr, "%d", &confno) != 1)
+ if (sscanf(confstr, "%30d", &confno) != 1)
confno = 0;
}
if (confno) {
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 79736584a..fb8d86e5d 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -221,7 +221,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
if (!(k&1)) { /* if in password state */
if (j == '#') { /* end of password */
/* see if this is an integer */
- if (sscanf(args.passcode,"%d",&j) < 1) { /* nope, it must be a filename */
+ if (sscanf(args.passcode,"%30d",&j) < 1) { /* nope, it must be a filename */
fp = fopen(args.passcode,"r");
if (!fp) {
ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,chan->name);
@@ -247,7 +247,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
ast_debug(1, "Mailbox: %s\n",args.mailbox);
/* password must be in valid format (numeric) */
- if (sscanf(args.passcode,"%d", &j) < 1)
+ if (sscanf(args.passcode,"%30d", &j) < 1)
continue;
/* if we got it */
if (!strcmp(exten,args.passcode)) {
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 46b7aee7f..7f65d6cfe 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -308,7 +308,7 @@ static int reload_followme(int reload)
featuredigittostr = ast_variable_retrieve(cfg, "general", "featuredigittimeout");
if (!ast_strlen_zero(featuredigittostr)) {
- if (!sscanf(featuredigittostr, "%d", &featuredigittimeout))
+ if (!sscanf(featuredigittostr, "%30d", &featuredigittimeout))
featuredigittimeout = 5000;
}
diff --git a/apps/app_macro.c b/apps/app_macro.c
index db24d263a..f3d7a82f1 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -205,18 +205,18 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
/* does the user want a deeper rabbit hole? */
s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
if (s)
- sscanf(s, "%d", &maxdepth);
+ sscanf(s, "%30d", &maxdepth);
/* Count how many levels deep the rabbit hole goes */
s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
if (s)
- sscanf(s, "%d", &depth);
+ sscanf(s, "%30d", &depth);
/* Used for detecting whether to return when a Macro is called from another Macro after hangup */
if (strcmp(chan->exten, "h") == 0)
pbx_builtin_setvar_helper(chan, "MACRO_IN_HANGUP", "1");
inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP");
if (!ast_strlen_zero(inhangupc))
- sscanf(inhangupc, "%d", &inhangup);
+ sscanf(inhangupc, "%30d", &inhangup);
if (depth >= maxdepth) {
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
@@ -465,7 +465,7 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) {
/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
normally if there is any problem */
- if (sscanf(offsets, "%d", &offset) == 1) {
+ if (sscanf(offsets, "%30d", &offset) == 1) {
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->cid.cid_num)) {
chan->priority += offset;
}
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 6acdfc010..00dcba682 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -902,7 +902,7 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
AST_LIST_INSERT_HEAD(&confs, cnf, list);
/* Reserve conference number in map */
- if ((sscanf(cnf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
+ if ((sscanf(cnf->confno, "%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
conf_map[confno_int] = 1;
cnfout:
@@ -1499,7 +1499,7 @@ static int dispose_conf(struct ast_conference *conf)
AST_LIST_LOCK(&confs);
if (ast_atomic_dec_and_test(&conf->refcount)) {
/* Take the conference room number out of an inuse state */
- if ((sscanf(conf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
+ if ((sscanf(conf->confno, "%4d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
conf_map[confno_int] = 0;
conf_free(conf);
res = 1;
@@ -1663,7 +1663,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
/* Possible timeout waiting for marked user */
if ((confflags & CONFFLAG_WAITMARKED) &&
!ast_strlen_zero(optargs[OPT_ARG_WAITMARKED]) &&
- (sscanf(optargs[OPT_ARG_WAITMARKED], "%d", &opt_waitmarked_timeout) == 1) &&
+ (sscanf(optargs[OPT_ARG_WAITMARKED], "%30d", &opt_waitmarked_timeout) == 1) &&
(opt_waitmarked_timeout > 0)) {
timeout = time(NULL) + opt_waitmarked_timeout;
}
@@ -3223,7 +3223,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
if (!res)
ast_waitstream(chan, "");
} else {
- if (sscanf(confno, "%d", &confno_int) == 1) {
+ if (sscanf(confno, "%30d", &confno_int) == 1) {
if (!ast_test_flag(&confflags, CONFFLAG_QUIET)) {
res = ast_streamfile(chan, "conf-enteringno", chan->language);
if (!res) {
@@ -3350,7 +3350,7 @@ static struct ast_conf_user *find_user(struct ast_conference *conf, char *caller
struct ast_conf_user *user = NULL;
int cid;
- sscanf(callerident, "%i", &cid);
+ sscanf(callerident, "%30i", &cid);
if (conf && callerident) {
AST_LIST_TRAVERSE(&conf->userlist, user, list) {
if (cid == user->user_no)
@@ -3825,7 +3825,7 @@ static void load_config_meetme(void)
rt_log_members = 1;
if ((val = ast_variable_retrieve(cfg, "general", "audiobuffers"))) {
- if ((sscanf(val, "%d", &audio_buffers) != 1)) {
+ if ((sscanf(val, "%30d", &audio_buffers) != 1)) {
ast_log(LOG_WARNING, "audiobuffers setting must be a number, not '%s'\n", val);
audio_buffers = DEFAULT_AUDIO_BUFFERS;
} else if ((audio_buffers < DAHDI_DEFAULT_NUM_BUFS) || (audio_buffers > DAHDI_MAX_NUM_BUFS)) {
@@ -3842,19 +3842,19 @@ static void load_config_meetme(void)
if ((val = ast_variable_retrieve(cfg, "general", "logmembercount")))
rt_log_members = ast_true(val);
if ((val = ast_variable_retrieve(cfg, "general", "fuzzystart"))) {
- if ((sscanf(val, "%d", &fuzzystart) != 1)) {
+ if ((sscanf(val, "%30d", &fuzzystart) != 1)) {
ast_log(LOG_WARNING, "fuzzystart must be a number, not '%s'\n", val);
fuzzystart = 0;
}
}
if ((val = ast_variable_retrieve(cfg, "general", "earlyalert"))) {
- if ((sscanf(val, "%d", &earlyalert) != 1)) {
+ if ((sscanf(val, "%30d", &earlyalert) != 1)) {
ast_log(LOG_WARNING, "earlyalert must be a number, not '%s'\n", val);
earlyalert = 0;
}
}
if ((val = ast_variable_retrieve(cfg, "general", "endalert"))) {
- if ((sscanf(val, "%d", &endalert) != 1)) {
+ if ((sscanf(val, "%30d", &endalert) != 1)) {
ast_log(LOG_WARNING, "endalert must be a number, not '%s'\n", val);
endalert = 0;
}
@@ -5419,7 +5419,7 @@ static int sla_build_trunk(struct ast_config *cfg, const char *cat)
if (!strcasecmp(var->name, "autocontext"))
ast_string_field_set(trunk, autocontext, var->value);
else if (!strcasecmp(var->name, "ringtimeout")) {
- if (sscanf(var->value, "%u", &trunk->ring_timeout) != 1) {
+ if (sscanf(var->value, "%30u", &trunk->ring_timeout) != 1) {
ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for trunk '%s'\n",
var->value, trunk->name);
trunk->ring_timeout = 0;
@@ -5495,13 +5495,13 @@ static void sla_add_trunk_to_station(struct sla_station *station, struct ast_var
char *name, *value = cur;
name = strsep(&value, "=");
if (!strcasecmp(name, "ringtimeout")) {
- if (sscanf(value, "%u", &trunk_ref->ring_timeout) != 1) {
+ if (sscanf(value, "%30u", &trunk_ref->ring_timeout) != 1) {
ast_log(LOG_WARNING, "Invalid ringtimeout value '%s' for "
"trunk '%s' on station '%s'\n", value, trunk->name, station->name);
trunk_ref->ring_timeout = 0;
}
} else if (!strcasecmp(name, "ringdelay")) {
- if (sscanf(value, "%u", &trunk_ref->ring_delay) != 1) {
+ if (sscanf(value, "%30u", &trunk_ref->ring_delay) != 1) {
ast_log(LOG_WARNING, "Invalid ringdelay value '%s' for "
"trunk '%s' on station '%s'\n", value, trunk->name, station->name);
trunk_ref->ring_delay = 0;
@@ -5550,13 +5550,13 @@ static int sla_build_station(struct ast_config *cfg, const char *cat)
else if (!strcasecmp(var->name, "autocontext"))
ast_string_field_set(station, autocontext, var->value);
else if (!strcasecmp(var->name, "ringtimeout")) {
- if (sscanf(var->value, "%u", &station->ring_timeout) != 1) {
+ if (sscanf(var->value, "%30u", &station->ring_timeout) != 1) {
ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for station '%s'\n",
var->value, station->name);
station->ring_timeout = 0;
}
} else if (!strcasecmp(var->name, "ringdelay")) {
- if (sscanf(var->value, "%u", &station->ring_delay) != 1) {
+ if (sscanf(var->value, "%30u", &station->ring_delay) != 1) {
ast_log(LOG_WARNING, "Invalid ringdelay '%s' specified for station '%s'\n",
var->value, station->name);
station->ring_delay = 0;
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index cce2fafb5..f0d3ed26c 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -1715,7 +1715,7 @@ static int minivm_record_exec(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
int gain;
- if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) {
+ if (sscanf(opts[OPT_ARG_RECORDGAIN], "%30d", &gain) != 1) {
ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]);
return -1;
} else
@@ -2137,7 +2137,7 @@ static int create_vmaccount(char *name, struct ast_variable *var, int realtime)
} else if (!strcasecmp(var->name, "pager")) {
ast_copy_string(vmu->pager, var->value, sizeof(vmu->pager));
} else if (!strcasecmp(var->name, "volgain")) {
- sscanf(var->value, "%lf", &vmu->volgain);
+ sscanf(var->value, "%30lf", &vmu->volgain);
} else {
ast_log(LOG_ERROR, "Unknown configuration option for minivm account %s : %s\n", name, var->name);
}
@@ -2308,7 +2308,7 @@ static int apply_general_options(struct ast_variable *var)
global_silencethreshold = atoi(var->value);
} else if (!strcmp(var->name, "maxmessage")) {
int x;
- if (sscanf(var->value, "%d", &x) == 1) {
+ if (sscanf(var->value, "%30d", &x) == 1) {
global_vmmaxmessage = x;
} else {
error ++;
@@ -2316,7 +2316,7 @@ static int apply_general_options(struct ast_variable *var)
}
} else if (!strcmp(var->name, "minmessage")) {
int x;
- if (sscanf(var->value, "%d", &x) == 1) {
+ if (sscanf(var->value, "%30d", &x) == 1) {
global_vmminmessage = x;
if (global_maxsilence <= global_vmminmessage)
ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index f93bf130e..5ce745b02 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -390,7 +390,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, MUXFLAG_READVOLUME)) {
if (ast_strlen_zero(opts[OPT_ARG_READVOLUME])) {
ast_log(LOG_WARNING, "No volume level was provided for the heard volume ('v') option.\n");
- } else if ((sscanf(opts[OPT_ARG_READVOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) {
+ } else if ((sscanf(opts[OPT_ARG_READVOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) {
ast_log(LOG_NOTICE, "Heard volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_READVOLUME]);
} else {
readvol = get_volfactor(x);
@@ -400,7 +400,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, MUXFLAG_WRITEVOLUME)) {
if (ast_strlen_zero(opts[OPT_ARG_WRITEVOLUME])) {
ast_log(LOG_WARNING, "No volume level was provided for the spoken volume ('V') option.\n");
- } else if ((sscanf(opts[OPT_ARG_WRITEVOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) {
+ } else if ((sscanf(opts[OPT_ARG_WRITEVOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) {
ast_log(LOG_NOTICE, "Spoken volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_WRITEVOLUME]);
} else {
writevol = get_volfactor(x);
@@ -410,7 +410,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, MUXFLAG_VOLUME)) {
if (ast_strlen_zero(opts[OPT_ARG_VOLUME])) {
ast_log(LOG_WARNING, "No volume level was provided for the combined volume ('W') option.\n");
- } else if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) {
+ } else if ((sscanf(opts[OPT_ARG_VOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) {
ast_log(LOG_NOTICE, "Combined volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_VOLUME]);
} else {
readvol = writevol = get_volfactor(x);
diff --git a/apps/app_morsecode.c b/apps/app_morsecode.c
index 6c88ed32c..81cdd2d61 100644
--- a/apps/app_morsecode.c
+++ b/apps/app_morsecode.c
@@ -112,13 +112,13 @@ static int morsecode_exec(struct ast_channel *chan, void *data)
/* Use variable MORESEDITLEN, if set (else 80) */
ditlenc = pbx_builtin_getvar_helper(chan, "MORSEDITLEN");
- if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%d", &ditlen) != 1)) {
+ if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%30d", &ditlen) != 1)) {
ditlen = 80;
}
/* Use variable MORSETONE, if set (else 800) */
tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
- if (ast_strlen_zero(tonec) || (sscanf(tonec, "%d", &tone) != 1)) {
+ if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
tone = 800;
}
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c
index bee5dae1d..e457b0d9a 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -246,7 +246,7 @@ static int osp_create_provider(
ast_log(LOG_WARNING, "OSP: Too many Service Points at line %d\n", v->lineno);
}
} else if (!strcasecmp(v->name, "maxconnections")) {
- if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_MAXCONNECTIONS) && (t <= OSP_MAX_MAXCONNECTIONS)) {
+ if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_MAXCONNECTIONS) && (t <= OSP_MAX_MAXCONNECTIONS)) {
p->maxconnections = t;
ast_debug(1, "OSP: maxconnections '%d'\n", t);
} else {
@@ -254,7 +254,7 @@ static int osp_create_provider(
OSP_MIN_MAXCONNECTIONS, OSP_MAX_MAXCONNECTIONS, v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "retrydelay")) {
- if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_RETRYDELAY) && (t <= OSP_MAX_RETRYDELAY)) {
+ if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_RETRYDELAY) && (t <= OSP_MAX_RETRYDELAY)) {
p->retrydelay = t;
ast_debug(1, "OSP: retrydelay '%d'\n", t);
} else {
@@ -262,7 +262,7 @@ static int osp_create_provider(
OSP_MIN_RETRYDELAY, OSP_MAX_RETRYDELAY, v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "retrylimit")) {
- if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_RETRYLIMIT) && (t <= OSP_MAX_RETRYLIMIT)) {
+ if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_RETRYLIMIT) && (t <= OSP_MAX_RETRYLIMIT)) {
p->retrylimit = t;
ast_debug(1, "OSP: retrylimit '%d'\n", t);
} else {
@@ -270,7 +270,7 @@ static int osp_create_provider(
OSP_MIN_RETRYLIMIT, OSP_MAX_RETRYLIMIT, v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "timeout")) {
- if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_TIMEOUT) && (t <= OSP_MAX_TIMEOUT)) {
+ if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_TIMEOUT) && (t <= OSP_MAX_TIMEOUT)) {
p->timeout = t;
ast_debug(1, "OSP: timeout '%d'\n", t);
} else {
@@ -281,7 +281,7 @@ static int osp_create_provider(
ast_copy_string(p->source, v->value, sizeof(p->source));
ast_debug(1, "OSP: source '%s'\n", p->source);
} else if (!strcasecmp(v->name, "authpolicy")) {
- if ((sscanf(v->value, "%d", &t) == 1) && ((t == OSP_AUTH_NO) || (t == OSP_AUTH_YES) || (t == OSP_AUTH_EXCLUSIVE))) {
+ if ((sscanf(v->value, "%30d", &t) == 1) && ((t == OSP_AUTH_NO) || (t == OSP_AUTH_YES) || (t == OSP_AUTH_EXCLUSIVE))) {
p->authpolicy = t;
ast_debug(1, "OSP: authpolicy '%d'\n", t);
} else {
@@ -1391,11 +1391,11 @@ static int osplookup_exec(
headp = &chan->varshead;
AST_LIST_TRAVERSE(headp, current, entries) {
if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
- if (sscanf(ast_var_value(current), "%d", &result.inhandle) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &result.inhandle) != 1) {
result.inhandle = OSP_INVALID_HANDLE;
}
} else if (!strcasecmp(ast_var_name(current), "OSPINTIMELIMIT")) {
- if (sscanf(ast_var_value(current), "%d", &result.intimelimit) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &result.intimelimit) != 1) {
result.intimelimit = OSP_DEF_TIMELIMIT;
}
} else if (!strcasecmp(ast_var_name(current), "OSPINNETWORKID")) {
@@ -1532,7 +1532,7 @@ static int ospnext_exec(
AST_STANDARD_APP_ARGS(args, tmp);
- if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%d", &cause) != 1) {
+ if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%30d", &cause) != 1) {
cause = 0;
}
ast_debug(1, "OSPNext: cause '%d'\n", cause);
@@ -1550,23 +1550,23 @@ static int ospnext_exec(
headp = &chan->varshead;
AST_LIST_TRAVERSE(headp, current, entries) {
if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
- if (sscanf(ast_var_value(current), "%d", &result.inhandle) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &result.inhandle) != 1) {
result.inhandle = OSP_INVALID_HANDLE;
}
} else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
- if (sscanf(ast_var_value(current), "%d", &result.outhandle) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &result.outhandle) != 1) {
result.outhandle = OSP_INVALID_HANDLE;
}
} else if (!strcasecmp(ast_var_name(current), "OSPINTIMELIMIT")) {
- if (sscanf(ast_var_value(current), "%d", &result.intimelimit) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &result.intimelimit) != 1) {
result.intimelimit = OSP_DEF_TIMELIMIT;
}
} else if (!strcasecmp(ast_var_name(current), "OSPOUTCALLIDTYPES")) {
- if (sscanf(ast_var_value(current), "%d", &callidtypes) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &callidtypes) != 1) {
callidtypes = OSP_CALLID_UNDEFINED;
}
} else if (!strcasecmp(ast_var_name(current), "OSPRESULTS")) {
- if (sscanf(ast_var_value(current), "%d", &result.numresults) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &result.numresults) != 1) {
result.numresults = 0;
}
}
@@ -1685,11 +1685,11 @@ static int ospfinished_exec(
headp = &chan->varshead;
AST_LIST_TRAVERSE(headp, current, entries) {
if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
- if (sscanf(ast_var_value(current), "%d", &inhandle) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &inhandle) != 1) {
inhandle = OSP_INVALID_HANDLE;
}
} else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
- if (sscanf(ast_var_value(current), "%d", &outhandle) != 1) {
+ if (sscanf(ast_var_value(current), "%30d", &outhandle) != 1) {
outhandle = OSP_INVALID_HANDLE;
}
} else if (!recorded &&
@@ -1706,7 +1706,7 @@ static int ospfinished_exec(
ast_debug(1, "OSPFinish: OSPOUTHANDLE '%d'\n", outhandle);
ast_debug(1, "OSPFinish: recorded '%d'\n", recorded);
- if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%d", &cause) != 1) {
+ if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%30d", &cause) != 1) {
cause = 0;
}
ast_debug(1, "OSPFinish: cause '%d'\n", cause);
@@ -1798,7 +1798,7 @@ static int osp_load(int reload)
t = ast_variable_retrieve(cfg, OSP_GENERAL_CAT, "tokenformat");
if (t) {
- if ((sscanf(t, "%d", &v) == 1) &&
+ if ((sscanf(t, "%30d", &v) == 1) &&
((v == TOKEN_ALGO_SIGNED) || (v == TOKEN_ALGO_UNSIGNED) || (v == TOKEN_ALGO_BOTH)))
{
osp_tokenformat = v;
diff --git a/apps/app_privacy.c b/apps/app_privacy.c
index e8e0f4d1c..c8bd81179 100644
--- a/apps/app_privacy.c
+++ b/apps/app_privacy.c
@@ -90,13 +90,13 @@ static int privacy_exec (struct ast_channel *chan, void *data)
AST_STANDARD_APP_ARGS(args, parse);
if (args.maxretries) {
- if (sscanf(args.maxretries, "%d", &x) == 1)
+ if (sscanf(args.maxretries, "%30d", &x) == 1)
maxretries = x;
else
ast_log(LOG_WARNING, "Invalid max retries argument\n");
}
if (args.minlength) {
- if (sscanf(args.minlength, "%d", &x) == 1)
+ if (sscanf(args.minlength, "%30d", &x) == 1)
minlength = x;
else
ast_log(LOG_WARNING, "Invalid min length argument\n");
diff --git a/apps/app_queue.c b/apps/app_queue.c
index c99000f9f..917e5f868 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4538,7 +4538,7 @@ static int aqm_exec(struct ast_channel *chan, void *data)
}
if (!ast_strlen_zero(args.penalty)) {
- if ((sscanf(args.penalty, "%d", &penalty) != 1) || penalty < 0) {
+ if ((sscanf(args.penalty, "%30d", &penalty) != 1) || penalty < 0) {
ast_log(LOG_WARNING, "Penalty '%s' is invalid, must be an integer >= 0\n", args.penalty);
penalty = 0;
}
@@ -4699,7 +4699,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
/* Get the priority from the variable ${QUEUE_PRIO} */
user_priority = pbx_builtin_getvar_helper(chan, "QUEUE_PRIO");
if (user_priority) {
- if (sscanf(user_priority, "%d", &prio) == 1) {
+ if (sscanf(user_priority, "%30d", &prio) == 1) {
ast_debug(1, "%s: Got priority %d from ${QUEUE_PRIO}.\n", chan->name, prio);
} else {
ast_log(LOG_WARNING, "${QUEUE_PRIO}: Invalid value (%s), channel %s.\n",
@@ -4714,7 +4714,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
/* Get the maximum penalty from the variable ${QUEUE_MAX_PENALTY} */
if ((max_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MAX_PENALTY"))) {
- if (sscanf(max_penalty_str, "%d", &max_penalty) == 1) {
+ if (sscanf(max_penalty_str, "%30d", &max_penalty) == 1) {
ast_debug(1, "%s: Got max penalty %d from ${QUEUE_MAX_PENALTY}.\n", chan->name, max_penalty);
} else {
ast_log(LOG_WARNING, "${QUEUE_MAX_PENALTY}: Invalid value (%s), channel %s.\n",
@@ -4726,7 +4726,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
}
if ((min_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MIN_PENALTY"))) {
- if (sscanf(min_penalty_str, "%d", &min_penalty) == 1) {
+ if (sscanf(min_penalty_str, "%30d", &min_penalty) == 1) {
ast_debug(1, "%s: Got min penalty %d from ${QUEUE_MIN_PENALTY}.\n", chan->name, min_penalty);
} else {
ast_log(LOG_WARNING, "${QUEUE_MIN_PENALTY}: Invalid value (%s), channel %s.\n",
@@ -5983,7 +5983,7 @@ static int manager_add_queue_member(struct mansession *s, const struct message *
if (ast_strlen_zero(penalty_s))
penalty = 0;
- else if (sscanf(penalty_s, "%d", &penalty) != 1 || penalty < 0)
+ else if (sscanf(penalty_s, "%30d", &penalty) != 1 || penalty < 0)
penalty = 0;
if (ast_strlen_zero(paused_s))
@@ -6175,7 +6175,7 @@ static char *handle_queue_add_member(struct ast_cli_entry *e, int cmd, struct as
queuename = a->argv[5];
interface = a->argv[3];
if (a->argc >= 8) {
- if (sscanf(a->argv[7], "%d", &penalty) == 1) {
+ if (sscanf(a->argv[7], "%30d", &penalty) == 1) {
if (penalty < 0) {
ast_cli(a->fd, "Penalty must be >= 0\n");
penalty = 0;
diff --git a/apps/app_readfile.c b/apps/app_readfile.c
index 8762ef860..d7a114276 100644
--- a/apps/app_readfile.c
+++ b/apps/app_readfile.c
@@ -73,7 +73,7 @@ static int readfile_exec(struct ast_channel *chan, void *data)
}
if (length) {
- if ((sscanf(length, "%d", &len) != 1) || (len < 0)) {
+ if ((sscanf(length, "%30d", &len) != 1) || (len < 0)) {
ast_log(LOG_WARNING, "%s is not a positive number, defaulting length to max\n", length);
len = 0;
}
diff --git a/apps/app_record.c b/apps/app_record.c
index e295e07e8..7d8ac5494 100644
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -145,7 +145,7 @@ static int record_exec(struct ast_channel *chan, void *data)
return -1;
}
if (args.silence) {
- if ((sscanf(args.silence, "%d", &i) == 1) && (i > -1)) {
+ if ((sscanf(args.silence, "%30d", &i) == 1) && (i > -1)) {
silence = i * 1000;
} else if (!ast_strlen_zero(args.silence)) {
ast_log(LOG_WARNING, "'%s' is not a valid silence duration\n", args.silence);
@@ -153,7 +153,7 @@ static int record_exec(struct ast_channel *chan, void *data)
}
if (args.maxduration) {
- if ((sscanf(args.maxduration, "%d", &i) == 1) && (i > -1))
+ if ((sscanf(args.maxduration, "%30d", &i) == 1) && (i > -1))
/* Convert duration to milliseconds */
maxduration = i * 1000;
else if (!ast_strlen_zero(args.maxduration))
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
index 608febad4..80c6af3c2 100644
--- a/apps/app_rpt.c
+++ b/apps/app_rpt.c
@@ -810,7 +810,7 @@ static int myatoi(const char *str)
if (str == NULL)
return -1;
/* leave this %i alone, non-base-10 input is useful here */
- if (sscanf(str, "%i", &ret) != 1)
+ if (sscanf(str, "%30i", &ret) != 1)
return -1;
return ret;
}
@@ -979,7 +979,7 @@ static void load_rpt_vars(int n, int init)
/* do not use atoi() here, we need to be able to have
the input specified in hex or decimal so we use
sscanf with a %i */
- if (sscanf(var->value, "%i", &rpt_vars[n].p.iobase) != 1)
+ if (sscanf(var->value, "%30i", &rpt_vars[n].p.iobase) != 1)
rpt_vars[n].p.iobase = DEFAULT_IOBASE;
} else if (!strcmp(var->name, "functions")) {
rpt_vars[n].p.simple = 0;
@@ -1671,7 +1671,7 @@ static int send_tone_telemetry(struct ast_channel *chan, const char *tonestring)
tonesubset = strsep(&stringp, ")");
if (!tonesubset)
break;
- if (sscanf(tonesubset, "(%d,%d,%d,%d", &f1, &f2, &duration, &amplitude) != 4)
+ if (sscanf(tonesubset, "(%30d,%30d,%30d,%30d", &f1, &f2, &duration, &amplitude) != 4)
break;
res = play_tone_pair(chan, f1, f2, duration, amplitude);
if (res)
@@ -3482,6 +3482,8 @@ static int collect_function_digits(struct rpt *myrpt, char *digits, int command_
static void handle_link_data(struct rpt *myrpt, struct rpt_link *mylink, char *str)
{
+ /* XXX ATTENTION: if you change the size of these arrays you MUST
+ * change the limits in corresponding sscanf() calls below. */
char cmd[300] = "", dest[300], src[300], c;
int seq, res;
struct rpt_link *l;
@@ -3499,7 +3501,7 @@ static void handle_link_data(struct rpt *myrpt, struct rpt_link *mylink, char *s
ast_softhangup(mylink->chan, AST_SOFTHANGUP_DEV);
return;
}
- if (sscanf(str, "%s %s %s %d %c", cmd, dest, src, &seq, &c) != 5) {
+ if (sscanf(str, "%299s %299s %299s %30d %1c", cmd, dest, src, &seq, &c) != 5) {
ast_log(LOG_WARNING, "Unable to parse link string %s\n", str);
return;
}
@@ -4103,7 +4105,7 @@ static int split_decimal(char *input, int *ints, int *decs, int places)
{
double input2 = 0.0;
long long modifier = (long long)pow(10.0, (double)places);
- if (sscanf(input, "%lf", &input2) == 1) {
+ if (sscanf(input, "%30lf", &input2) == 1) {
long long input3 = input2 * modifier;
*ints = input3 / modifier;
*decs = input3 % modifier;
@@ -5370,12 +5372,16 @@ static int handle_remote_dtmf_digit(struct rpt *myrpt, char c, char *keyed, int
static int handle_remote_data(struct rpt *myrpt, char *str)
{
+ /* XXX ATTENTION: if you change the size of these arrays you MUST
+ * change the limits in corresponding sscanf() calls below. */
char cmd[300], dest[300], src[300], c;
int seq, res;
if (!strcmp(str, discstr))
return 0;
- if (sscanf(str, "%s %s %s %d %c", cmd, dest, src, &seq, &c) != 5) {
+ /* XXX WARNING: be very careful with the limits on the folowing
+ * sscanf() call, make sure they match the values defined above */
+ if (sscanf(str, "%299s %299s %299s %30d %1c", cmd, dest, src, &seq, &c) != 5) {
ast_log(LOG_WARNING, "Unable to parse link string %s\n", str);
return 0;
}
diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c
index f1c9df3cb..cd8016e21 100644
--- a/apps/app_setcallerid.c
+++ b/apps/app_setcallerid.c
@@ -70,7 +70,7 @@ static int setcallerid_pres_exec(struct ast_channel *chan, void *data)
}
/* For interface consistency, permit the argument to be specified as a number */
- if (sscanf(data, "%d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
+ if (sscanf(data, "%30d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
pres = ast_parse_caller_presentation(data);
}
diff --git a/apps/app_sms.c b/apps/app_sms.c
index a11244fc9..7b9c23063 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -815,13 +815,9 @@ static void sms_readfile(sms_t * h, char *fn)
else if (!strcmp(line, "rp"))
h->rp = (atoi(p) ? 1 : 0);
else if (!strcmp(line, "scts")) { /* get date/time */
- int Y,
- m,
- d,
- H,
- M,
- S;
- if (sscanf (p, "%d-%d-%dT%d:%d:%d", &Y, &m, &d, &H, &M, &S) == 6) {
+ int Y, m, d, H, M, S;
+ /* XXX Why aren't we using ast_strptime here? */
+ if (sscanf(p, "%4d-%2d-%2dT%2d:%2d:%2d", &Y, &m, &d, &H, &M, &S) == 6) {
struct ast_tm t = { 0, };
t.tm_year = Y - 1900;
t.tm_mon = m - 1;
diff --git a/apps/app_stack.c b/apps/app_stack.c
index 7e4ac691c..cb4cf87ee 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -413,7 +413,7 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, char **arg
ast_debug(1, "Gosub called with %d arguments: 0:%s 1:%s 2:%s 3:%s 4:%s\n", argc, argv[0], argv[1], argv[2], argv[3], argc == 5 ? argv[4] : "");
- if (sscanf(argv[3], "%d", &priority) != 1 || priority < 1) {
+ if (sscanf(argv[3], "%30d", &priority) != 1 || priority < 1) {
/* Lookup the priority label */
if ((priority = ast_findlabel_extension(chan, argv[1], argv[2], argv[3], chan->cid.cid_num)) < 0) {
ast_log(LOG_ERROR, "Priority '%s' not found in '%s@%s'\n", argv[3], argv[2], argv[1]);
diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c
index fb862440d..beeb1e4ea 100644
--- a/apps/app_talkdetect.c
+++ b/apps/app_talkdetect.c
@@ -83,11 +83,11 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
tmp = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, tmp);
- if (!ast_strlen_zero(args.silence) && (sscanf(args.silence, "%d", &x) == 1) && (x > 0))
+ if (!ast_strlen_zero(args.silence) && (sscanf(args.silence, "%30d", &x) == 1) && (x > 0))
sil = x;
- if (!ast_strlen_zero(args.min) && (sscanf(args.min, "%d", &x) == 1) && (x > 0))
+ if (!ast_strlen_zero(args.min) && (sscanf(args.min, "%30d", &x) == 1) && (x > 0))
min = x;
- if (!ast_strlen_zero(args.max) && (sscanf(args.max, "%d", &x) == 1) && (x > 0))
+ if (!ast_strlen_zero(args.max) && (sscanf(args.max, "%30d", &x) == 1) && (x > 0))
max = x;
ast_debug(1, "Preparing detect of '%s', sil=%d, min=%d, max=%d\n", args.filename, sil, min, max);
diff --git a/apps/app_verbose.c b/apps/app_verbose.c
index 525cc1c55..53e5ea802 100644
--- a/apps/app_verbose.c
+++ b/apps/app_verbose.c
@@ -65,7 +65,7 @@ static int verbose_exec(struct ast_channel *chan, void *data)
args.level = "0";
}
- if (sscanf(args.level, "%d", &vsize) != 1) {
+ if (sscanf(args.level, "%30d", &vsize) != 1) {
vsize = 0;
ast_log(LOG_WARNING, "'%s' is not a verboser number\n", args.level);
}
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 622ff4a41..fc4977483 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -750,7 +750,7 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
} else if (!strcasecmp(var, "sayduration")) {
ast_set2_flag(vmu, ast_true(value), VM_SAYDURATION);
} else if (!strcasecmp(var, "saydurationm")) {
- if (sscanf(value, "%d", &x) == 1) {
+ if (sscanf(value, "%30d", &x) == 1) {
vmu->saydurationm = x;
} else {
ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
@@ -784,7 +784,7 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
vmu->maxmsg = MAXMSGLIMIT;
}
} else if (!strcasecmp(var, "backupdeleted")) {
- if (sscanf(value, "%d", &x) == 1)
+ if (sscanf(value, "%30d", &x) == 1)
vmu->maxdeletedmsg = x;
else if (ast_true(value))
vmu->maxdeletedmsg = MAXMSG;
@@ -799,7 +799,7 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
vmu->maxdeletedmsg = MAXMSGLIMIT;
}
} else if (!strcasecmp(var, "volgain")) {
- sscanf(value, "%lf", &vmu->volgain);
+ sscanf(value, "%30lf", &vmu->volgain);
} else if (!strcasecmp(var, "options")) {
apply_options(vmu, value);
}
@@ -2660,7 +2660,7 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
ast_odbc_release_obj(obj);
goto yuck;
}
- if (sscanf(rowdata, "%d", &x) != 1)
+ if (sscanf(rowdata, "%30d", &x) != 1)
ast_log(LOG_WARNING, "Failed to read message count!\n");
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
@@ -2706,7 +2706,7 @@ static int message_exists(char *dir, int msgnum)
ast_odbc_release_obj(obj);
goto yuck;
}
- if (sscanf(rowdata, "%d", &x) != 1)
+ if (sscanf(rowdata, "%30d", &x) != 1)
ast_log(LOG_WARNING, "Failed to read message count!\n");
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
@@ -3036,7 +3036,7 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
* find each file. */
msgdir = opendir(dir);
while ((msgdirent = readdir(msgdir))) {
- if (sscanf(msgdirent->d_name, "msg%d", &msgdirint) == 1 && msgdirint < MAXMSGLIMIT)
+ if (sscanf(msgdirent->d_name, "msg%30d", &msgdirint) == 1 && msgdirint < MAXMSGLIMIT)
map[msgdirint] = 1;
}
closedir(msgdir);
@@ -7734,7 +7734,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
int gain;
if (!ast_strlen_zero(opts[OPT_ARG_RECORDGAIN])) {
- if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) {
+ if (sscanf(opts[OPT_ARG_RECORDGAIN], "%30d", &gain) != 1) {
ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]);
return -1;
} else {
@@ -7747,7 +7747,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, OPT_AUTOPLAY) ) {
play_auto = 1;
if (opts[OPT_ARG_PLAYFOLDER]) {
- if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%d", &play_folder) != 1) {
+ if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%30d", &play_folder) != 1) {
ast_log(LOG_WARNING, "Invalid value '%s' provided for folder autoplay option\n", opts[OPT_ARG_PLAYFOLDER]);
}
} else {
@@ -8265,7 +8265,7 @@ static int vm_exec(struct ast_channel *chan, void *data)
if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
int gain;
- if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) {
+ if (sscanf(opts[OPT_ARG_RECORDGAIN], "%30d", &gain) != 1) {
ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]);
return -1;
} else {
@@ -9068,7 +9068,7 @@ static int load_config(int reload)
volgain = 0.0;
if ((val = ast_variable_retrieve(cfg, "general", "volgain")))
- sscanf(val, "%lf", &volgain);
+ sscanf(val, "%30lf", &volgain);
#ifdef ODBC_STORAGE
strcpy(odbc_database, "asterisk");
@@ -9108,7 +9108,7 @@ static int load_config(int reload)
if (!(val = ast_variable_retrieve(cfg, "general", "backupdeleted"))) {
maxdeletedmsg = 0;
} else {
- if (sscanf(val, "%d", &x) == 1)
+ if (sscanf(val, "%30d", &x) == 1)
maxdeletedmsg = x;
else if (ast_true(val))
maxdeletedmsg = MAXMSG;
@@ -9254,7 +9254,7 @@ static int load_config(int reload)
vmmaxsecs = 0;
if ((val = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
vmmaxsecs = x;
} else {
ast_log(LOG_WARNING, "Invalid max message time length\n");
@@ -9265,7 +9265,7 @@ static int load_config(int reload)
maxmessage_deprecate = 1;
ast_log(LOG_WARNING, "Setting 'maxmessage' has been deprecated in favor of 'maxsecs'.\n");
}
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
vmmaxsecs = x;
} else {
ast_log(LOG_WARNING, "Invalid max message time length\n");
@@ -9274,7 +9274,7 @@ static int load_config(int reload)
vmminsecs = 0;
if ((val = ast_variable_retrieve(cfg, "general", "minsecs"))) {
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
vmminsecs = x;
if (maxsilence <= vmminsecs)
ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
@@ -9287,7 +9287,7 @@ static int load_config(int reload)
maxmessage_deprecate = 1;
ast_log(LOG_WARNING, "Setting 'minmessage' has been deprecated in favor of 'minsecs'.\n");
}
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
vmminsecs = x;
if (maxsilence <= vmminsecs)
ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
@@ -9303,7 +9303,7 @@ static int load_config(int reload)
skipms = 3000;
if ((val = ast_variable_retrieve(cfg, "general", "maxgreet"))) {
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
maxgreet = x;
} else {
ast_log(LOG_WARNING, "Invalid max message greeting length\n");
@@ -9311,7 +9311,7 @@ static int load_config(int reload)
}
if ((val = ast_variable_retrieve(cfg, "general", "skipms"))) {
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
skipms = x;
} else {
ast_log(LOG_WARNING, "Invalid skipms value\n");
@@ -9320,7 +9320,7 @@ static int load_config(int reload)
maxlogins = 3;
if ((val = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
maxlogins = x;
} else {
ast_log(LOG_WARNING, "Invalid max failed login attempts\n");
@@ -9405,7 +9405,7 @@ static int load_config(int reload)
saydurationminfo = 2;
if ((val = ast_variable_retrieve(cfg, "general", "saydurationm"))) {
- if (sscanf(val, "%d", &x) == 1) {
+ if (sscanf(val, "%30d", &x) == 1) {
saydurationminfo = x;
} else {
ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
@@ -9468,7 +9468,7 @@ static int load_config(int reload)
poll_freq = DEFAULT_POLL_FREQ;
if ((val = ast_variable_retrieve(cfg, "general", "pollfreq"))) {
- if (sscanf(val, "%u", &poll_freq) != 1) {
+ if (sscanf(val, "%30u", &poll_freq) != 1) {
poll_freq = DEFAULT_POLL_FREQ;
ast_log(LOG_ERROR, "'%s' is not a valid value for the pollfreq option!\n", val);
}
diff --git a/apps/app_waitforring.c b/apps/app_waitforring.c
index b4248fee9..50fba47e2 100644
--- a/apps/app_waitforring.c
+++ b/apps/app_waitforring.c
@@ -52,7 +52,7 @@ static int waitforring_exec(struct ast_channel *chan, void *data)
double s;
int ms;
- if (!data || (sscanf(data, "%lg", &s) != 1)) {
+ if (!data || (sscanf(data, "%30lg", &s) != 1)) {
ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n");
return 0;
}
diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c
index dd00506d5..cf11d760d 100644
--- a/apps/app_waitforsilence.c
+++ b/apps/app_waitforsilence.c
@@ -157,9 +157,9 @@ static int waitforsilence_exec(struct ast_channel *chan, void *data)
res = ast_answer(chan); /* Answer the channel */
}
- if (!data || ( (sscanf(data, "%d,%d,%d", &silencereqd, &iterations, &timeout) != 3) &&
- (sscanf(data, "%d|%d", &silencereqd, &iterations) != 2) &&
- (sscanf(data, "%d", &silencereqd) != 1) ) ) {
+ if (!data || ( (sscanf(data, "%30d,%30d,%30d", &silencereqd, &iterations, &timeout) != 3) &&
+ (sscanf(data, "%30d,%30d", &silencereqd, &iterations) != 2) &&
+ (sscanf(data, "%30d", &silencereqd) != 1) ) ) {
ast_log(LOG_WARNING, "Using default value of 1000ms, 1 iteration, no timeout\n");
}
diff --git a/apps/app_waituntil.c b/apps/app_waituntil.c
index 1334683ce..0a42057bb 100644
--- a/apps/app_waituntil.c
+++ b/apps/app_waituntil.c
@@ -58,7 +58,7 @@ static int waituntil_exec(struct ast_channel *chan, void *data)
return 0;
}
- if (sscanf(data, "%ld%lf", (long *)&future.tv_sec, &fraction) == 0) {
+ if (sscanf(data, "%30ld%30lf", (long *)&future.tv_sec, &fraction) == 0) {
ast_log(LOG_WARNING, "WaitUntil called with non-numeric argument\n");
pbx_builtin_setvar_helper(chan, "WAITUNTILSTATUS", "FAILURE");
return 0;
diff --git a/asterisk-1.6.0.10-summary.html b/asterisk-1.6.0.10-summary.html
deleted file mode 100644
index 4a6dcb784..000000000
--- a/asterisk-1.6.0.10-summary.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Release Summary - asterisk-1.6.0.10</title></head>
-<body>
-<h1 align="center"><a name="top">Release Summary</a></h1>
-<h3 align="center">asterisk-1.6.0.10</h3>
-<h3 align="center">Date: 2009-06-05</h3>
-<h3 align="center">&lt;asteriskteam@digium.com&gt;</h3>
-<hr/>
-<h2 align="center">Table of Contents</h2>
-<ol>
- <li><a href="#summary">Summary</a></li>
- <li><a href="#contributors">Contributors</a></li>
- <li><a href="#issues">Closed Issues</a></li>
- <li><a href="#commits">Other Changes</a></li>
- <li><a href="#diffstat">Diffstat</a></li>
-</ol>
-<hr/>
-<a name="summary"><h2 align="center">Summary</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This release has been made to address one or more security vulnerabilities that have been identified. A security advisory document has been published for each vulnerability that includes additional information. Users of versions of Asterisk that are affected are strongly encouraged to review the advisories and determine what action they should take to protect their systems from these issues.</p>
-<p>Security Advisories: <a href="http://downloads.asterisk.org/pub/security/AST-2009-001.html">AST-2009-001</a></p>
-<p>The data in this summary reflects changes that have been made since the previous release, asterisk-1.6.0.9.</p>
-<hr/>
-<a name="contributors"><h2 align="center">Contributors</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This table lists the people who have submitted code, those that have tested patches, as well as those that reported issues on the issue tracker that were resolved in this release. For coders, the number is how many of their patches (of any size) were committed into this release. For testers, the number is the number of times their name was listed as assisting with testing a patch. Finally, for reporters, the number is the number of issues that they reported that were closed by commits that went into this release.</p>
-<table width="100%" border="0">
-<tr>
-<td width="33%"><h3>Coders</h3></td>
-<td width="33%"><h3>Testers</h3></td>
-<td width="33%"><h3>Reporters</h3></td>
-</tr>
-<tr valign="top">
-<td>
-5 dvossel<br/>
-3 lmadsen<br/>
-</td>
-<td>
-2 dvossel<br/>
-</td>
-<td>
-1 aragon<br/>
-1 mobeck<br/>
-</td>
-</tr>
-</table>
-<hr/>
-<a name="issues"><h2 align="center">Closed Issues</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all issues from the issue tracker that were closed by changes that went into this release.</p>
-<h3>Category: Channels/chan_iax2</h3><br/>
-<a href="http://bugs.digium.com/view.php?id=14717">#14717</a>: [patch] chan_iax2 reports endless if a peer cannot be registered (>100 logs/sec)<br/>
-Revision: <a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199206">199206</a><br/>
-Reporter: mobeck<br/>
-Testers: dvossel<br/>
-Coders: dvossel<br/>
-<br/>
-<a href="http://bugs.digium.com/view.php?id=14867">#14867</a>: IAX2 failed registration notices are spamming the CLI until /var/log/asterisk/messages file fills hard drive 100%<br/>
-Revision: <a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199206">199206</a><br/>
-Reporter: aragon<br/>
-Testers: dvossel<br/>
-Coders: dvossel<br/>
-<br/>
-<hr/>
-<a name="commits"><h2 align="center">Commits Not Associated with an Issue</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all changes that went into this release that did not directly close an issue from the issue tracker. The commits may have been marked as being related to an issue. If that is the case, the issue numbers are listed here, as well.</p>
-<table width="100%" border="1">
-<tr><td><b>Revision</b></td><td><b>Author</b></td><td><b>Summary</b></td><td><b>Issues Referenced</b></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199127">199127</a></td><td>lmadsen</td><td>Create 1.6.0.10 tag from 1.6.0.9.</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199132">199132</a></td><td>lmadsen</td><td>Update .version</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199207">199207</a></td><td>dvossel</td><td>Additional updates for AST-2009-001</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199212">199212</a></td><td>dvossel</td><td>update ChangeLog for AST-2009-001 updates</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199263">199263</a></td><td>dvossel</td><td>update ChangeLog</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/tags/1.6.0.10?view=revision&revision=199267">199267</a></td><td>lmadsen</td><td>Update ChangeLog</td>
-<td></td></tr></table>
-<hr/>
-<a name="diffstat"><h2 align="center">Diffstat Results</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This is a summary of the changes to the source code that went into this release that was generated using the diffstat utility.</p>
-<pre>
-.version | 2 -
-ChangeLog | 12 ++++++++
-channels/chan_iax2.c | 75 +++++++++++++++++++++++++++++++++++----------------
-3 files changed, 65 insertions(+), 24 deletions(-)
-</pre><br/>
-<hr/>
-</body>
-</html>
diff --git a/asterisk-1.6.0.10-summary.txt b/asterisk-1.6.0.10-summary.txt
deleted file mode 100644
index 21eaa5204..000000000
--- a/asterisk-1.6.0.10-summary.txt
+++ /dev/null
@@ -1,125 +0,0 @@
- Release Summary
-
- asterisk-1.6.0.10
-
- Date: 2009-06-05
-
- <asteriskteam@digium.com>
-
- ----------------------------------------------------------------------
-
- Table of Contents
-
- 1. Summary
- 2. Contributors
- 3. Closed Issues
- 4. Other Changes
- 5. Diffstat
-
- ----------------------------------------------------------------------
-
- Summary
-
- [Back to Top]
-
- This release has been made to address one or more security vulnerabilities
- that have been identified. A security advisory document has been published
- for each vulnerability that includes additional information. Users of
- versions of Asterisk that are affected are strongly encouraged to review
- the advisories and determine what action they should take to protect their
- systems from these issues.
-
- Security Advisories: AST-2009-001
-
- The data in this summary reflects changes that have been made since the
- previous release, asterisk-1.6.0.9.
-
- ----------------------------------------------------------------------
-
- Contributors
-
- [Back to Top]
-
- This table lists the people who have submitted code, those that have
- tested patches, as well as those that reported issues on the issue tracker
- that were resolved in this release. For coders, the number is how many of
- their patches (of any size) were committed into this release. For testers,
- the number is the number of times their name was listed as assisting with
- testing a patch. Finally, for reporters, the number is the number of
- issues that they reported that were closed by commits that went into this
- release.
-
- Coders Testers Reporters
- 5 dvossel 2 dvossel 1 aragon
- 3 lmadsen 1 mobeck
-
- ----------------------------------------------------------------------
-
- Closed Issues
-
- [Back to Top]
-
- This is a list of all issues from the issue tracker that were closed by
- changes that went into this release.
-
- Category: Channels/chan_iax2
-
- #14717: [patch] chan_iax2 reports endless if a peer cannot be registered
- (>100 logs/sec)
- Revision: 199206
- Reporter: mobeck
- Testers: dvossel
- Coders: dvossel
-
- #14867: IAX2 failed registration notices are spamming the CLI until
- /var/log/asterisk/messages file fills hard drive 100%
- Revision: 199206
- Reporter: aragon
- Testers: dvossel
- Coders: dvossel
-
- ----------------------------------------------------------------------
-
- Commits Not Associated with an Issue
-
- [Back to Top]
-
- This is a list of all changes that went into this release that did not
- directly close an issue from the issue tracker. The commits may have been
- marked as being related to an issue. If that is the case, the issue
- numbers are listed here, as well.
-
- +------------------------------------------------------------------------+
- | Revision | Author | Summary | Issues Referenced |
- |----------+---------+-------------------------------+-------------------|
- | 199127 | lmadsen | Create 1.6.0.10 tag from | |
- | | | 1.6.0.9. | |
- |----------+---------+-------------------------------+-------------------|
- | 199132 | lmadsen | Update .version | |
- |----------+---------+-------------------------------+-------------------|
- | 199207 | dvossel | Additional updates for | |
- | | | AST-2009-001 | |
- |----------+---------+-------------------------------+-------------------|
- | 199212 | dvossel | update ChangeLog for | |
- | | | AST-2009-001 updates | |
- |----------+---------+-------------------------------+-------------------|
- | 199263 | dvossel | update ChangeLog | |
- |----------+---------+-------------------------------+-------------------|
- | 199267 | lmadsen | Update ChangeLog | |
- +------------------------------------------------------------------------+
-
- ----------------------------------------------------------------------
-
- Diffstat Results
-
- [Back to Top]
-
- This is a summary of the changes to the source code that went into this
- release that was generated using the diffstat utility.
-
- .version | 2 -
- ChangeLog | 12 ++++++++
- channels/chan_iax2.c | 75 +++++++++++++++++++++++++++++++++++----------------
- 3 files changed, 65 insertions(+), 24 deletions(-)
-
- ----------------------------------------------------------------------
diff --git a/asterisk-1.6.0.9-summary.html b/asterisk-1.6.0.9-summary.html
deleted file mode 100644
index 9bfd3c087..000000000
--- a/asterisk-1.6.0.9-summary.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Release Summary - asterisk-1.6.0.9</title></head>
-<body>
-<h1 align="center"><a name="top">Release Summary</a></h1>
-<h3 align="center">asterisk-1.6.0.9</h3>
-<h3 align="center">Date: 2009-04-06</h3>
-<h3 align="center">&lt;asteriskteam@digium.com&gt;</h3>
-<hr/>
-<h2 align="center">Table of Contents</h2>
-<ol>
- <li><a href="#summary">Summary</a></li>
- <li><a href="#contributors">Contributors</a></li>
- <li><a href="#issues">Closed Issues</a></li>
- <li><a href="#commits">Other Changes</a></li>
- <li><a href="#diffstat">Diffstat</a></li>
-</ol>
-<hr/>
-<a name="summary"><h2 align="center">Summary</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This release includes only bug fixes. The changes included were made only to address problems that have been identified in this release series. Users should be able to safely upgrade to this version if this release series is already in use. Users considering upgrading from a previous release series are strongly encouraged to review the UPGRADE.txt document as well as the CHANGES document for information about upgrading to this release series.</p>
-<p>The data in this summary reflects changes that have been made since the previous release, asterisk-1.6.0.8.</p>
-<hr/>
-<a name="contributors"><h2 align="center">Contributors</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This table lists the people who have submitted code, those that have tested patches, as well as those that reported issues on the issue tracker that were resolved in this release. For coders, the number is how many of their patches (of any size) were committed into this release. For testers, the number is the number of times their name was listed as assisting with testing a patch. Finally, for reporters, the number is the number of issues that they reported that were closed by commits that went into this release.</p>
-<table width="100%" border="0">
-<tr>
-<td width="33%"><h3>Coders</h3></td>
-<td width="33%"><h3>Testers</h3></td>
-<td width="33%"><h3>Reporters</h3></td>
-</tr>
-<tr valign="top">
-<td>
-3 mmichelson<br/>
-2 kpfleming<br/>
-1 dvossel<br/>
-1 file<br/>
-1 russell<br/>
-1 tilghman<br/>
-</td>
-<td>
-1 BlargMaN<br/>
-1 lmadsen<br/>
-1 mmichelson<br/>
-1 qualleyiv<br/>
-1 tilghman<br/>
-</td>
-<td>
-1 BlargMaN<br/>
-1 cwolff09<br/>
-1 jamessan<br/>
-1 jvandal<br/>
-</td>
-</tr>
-</table>
-<hr/>
-<a name="issues"><h2 align="center">Closed Issues</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all issues from the issue tracker that were closed by changes that went into this release.</p>
-<h3>Category: Applications/app_voicemail</h3><br/>
-<a href="http://bugs.digium.com/view.php?id=14685">#14685</a>: When using IMAP voicemail storage, you cannot retrieve messages by logging into VoicemailMain()<br/>
-Revision: <a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186287">186287</a><br/>
-Reporter: BlargMaN<br/>
-Testers: BlargMaN, qualleyiv, mmichelson<br/>
-Coders: mmichelson<br/>
-<br/>
-<h3>Category: Applications/app_voicemail/NewFeature</h3><br/>
-<a href="http://bugs.digium.com/view.php?id=11678">#11678</a>: [patch] Notification email should use the voicemail's metadata<br/>
-Revision: <a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186446">186446</a><br/>
-Reporter: jamessan<br/>
-Testers: tilghman, lmadsen<br/>
-Coders: tilghman<br/>
-<br/>
-<h3>Category: Channels/chan_sip/General</h3><br/>
-<a href="http://bugs.digium.com/view.php?id=14819">#14819</a>: Chan_sip core dump on program execution<br/>
-Revision: <a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186517">186517</a><br/>
-Reporter: cwolff09<br/>
-Coders: mmichelson<br/>
-<br/>
-<h3>Category: PBX/pbx_dundi</h3><br/>
-<a href="http://bugs.digium.com/view.php?id=14804">#14804</a>: Crash with DUNDi<br/>
-Revision: <a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186322">186322</a><br/>
-Reporter: jvandal<br/>
-Coders: file<br/>
-<br/>
-<hr/>
-<a name="commits"><h2 align="center">Commits Not Associated with an Issue</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all changes that went into this release that did not directly close an issue from the issue tracker. The commits may have been marked as being related to an issue. If that is the case, the issue numbers are listed here, as well.</p>
-<table width="100%" border="1">
-<tr><td><b>Revision</b></td><td><b>Author</b></td><td><b>Summary</b></td><td><b>Issues Referenced</b></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186105">186105</a></td><td>kpfleming</td><td>ensure that the buffer passed to DAHDI_SET_BUFINFO is fully initialized</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186176">186176</a></td><td>mmichelson</td><td>Fix instructions in one-step parking comment to make more sense.</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186231">186231</a></td><td>russell</td><td>Fix a memory leak in cdr_radius.</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186380">186380</a></td><td>dvossel</td><td>audio_audiohook_write_list() did not correctly update sample size after ast_translate.</td>
-<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.6.0?view=revision&revision=186463">186463</a></td><td>kpfleming</td><td>Fix a bug where DAHDI/Zaptel channels would not properly switch formats when requested</td>
-<td></td></tr></table>
-<hr/>
-<a name="diffstat"><h2 align="center">Diffstat Results</h2></a>
-<center><a href="#top">[Back to Top]</a></center><br/><p>This is a summary of the changes to the source code that went into this release that was generated using the diffstat utility.</p>
-<pre>
-apps/app_voicemail.c | 143 +++++++++++++++++++++++++++++++-----------
-cdr/cdr_radius.c | 10 ++
-channels/chan_dahdi.c | 4 -
-channels/chan_sip.c | 1
-configs/features.conf.sample | 2
-configs/voicemail.conf.sample | 9 ++
-include/asterisk/crypto.h | 14 ++--
-main/audiohook.c | 1
-8 files changed, 135 insertions(+), 49 deletions(-)
-</pre><br/>
-<hr/>
-</body>
-</html>
diff --git a/asterisk-1.6.0.9-summary.txt b/asterisk-1.6.0.9-summary.txt
deleted file mode 100644
index 80652e20c..000000000
--- a/asterisk-1.6.0.9-summary.txt
+++ /dev/null
@@ -1,152 +0,0 @@
- Release Summary
-
- asterisk-1.6.0.9
-
- Date: 2009-04-06
-
- <asteriskteam@digium.com>
-
- ----------------------------------------------------------------------
-
- Table of Contents
-
- 1. Summary
- 2. Contributors
- 3. Closed Issues
- 4. Other Changes
- 5. Diffstat
-
- ----------------------------------------------------------------------
-
- Summary
-
- [Back to Top]
-
- This release includes only bug fixes. The changes included were made only
- to address problems that have been identified in this release series.
- Users should be able to safely upgrade to this version if this release
- series is already in use. Users considering upgrading from a previous
- release series are strongly encouraged to review the UPGRADE.txt document
- as well as the CHANGES document for information about upgrading to this
- release series.
-
- The data in this summary reflects changes that have been made since the
- previous release, asterisk-1.6.0.8.
-
- ----------------------------------------------------------------------
-
- Contributors
-
- [Back to Top]
-
- This table lists the people who have submitted code, those that have
- tested patches, as well as those that reported issues on the issue tracker
- that were resolved in this release. For coders, the number is how many of
- their patches (of any size) were committed into this release. For testers,
- the number is the number of times their name was listed as assisting with
- testing a patch. Finally, for reporters, the number is the number of
- issues that they reported that were closed by commits that went into this
- release.
-
- Coders Testers Reporters
- 3 mmichelson 1 BlargMaN 1 BlargMaN
- 2 kpfleming 1 lmadsen 1 cwolff09
- 1 dvossel 1 mmichelson 1 jamessan
- 1 file 1 qualleyiv 1 jvandal
- 1 russell 1 tilghman
- 1 tilghman
-
- ----------------------------------------------------------------------
-
- Closed Issues
-
- [Back to Top]
-
- This is a list of all issues from the issue tracker that were closed by
- changes that went into this release.
-
- Category: Applications/app_voicemail
-
- #14685: When using IMAP voicemail storage, you cannot retrieve messages by
- logging into VoicemailMain()
- Revision: 186287
- Reporter: BlargMaN
- Testers: BlargMaN, qualleyiv, mmichelson
- Coders: mmichelson
-
- Category: Applications/app_voicemail/NewFeature
-
- #11678: [patch] Notification email should use the voicemail's metadata
- Revision: 186446
- Reporter: jamessan
- Testers: tilghman, lmadsen
- Coders: tilghman
-
- Category: Channels/chan_sip/General
-
- #14819: Chan_sip core dump on program execution
- Revision: 186517
- Reporter: cwolff09
- Coders: mmichelson
-
- Category: PBX/pbx_dundi
-
- #14804: Crash with DUNDi
- Revision: 186322
- Reporter: jvandal
- Coders: file
-
- ----------------------------------------------------------------------
-
- Commits Not Associated with an Issue
-
- [Back to Top]
-
- This is a list of all changes that went into this release that did not
- directly close an issue from the issue tracker. The commits may have been
- marked as being related to an issue. If that is the case, the issue
- numbers are listed here, as well.
-
- +------------------------------------------------------------------------+
- | Revision | Author | Summary | Issues |
- | | | | Referenced |
- |----------+------------+-----------------------------------+------------|
- | | | ensure that the buffer passed to | |
- | 186105 | kpfleming | DAHDI_SET_BUFINFO is fully | |
- | | | initialized | |
- |----------+------------+-----------------------------------+------------|
- | | | Fix instructions in one-step | |
- | 186176 | mmichelson | parking comment to make more | |
- | | | sense. | |
- |----------+------------+-----------------------------------+------------|
- | 186231 | russell | Fix a memory leak in cdr_radius. | |
- |----------+------------+-----------------------------------+------------|
- | | | audio_audiohook_write_list() did | |
- | 186380 | dvossel | not correctly update sample size | |
- | | | after ast_translate. | |
- |----------+------------+-----------------------------------+------------|
- | | | Fix a bug where DAHDI/Zaptel | |
- | 186463 | kpfleming | channels would not properly | |
- | | | switch formats when requested | |
- +------------------------------------------------------------------------+
-
- ----------------------------------------------------------------------
-
- Diffstat Results
-
- [Back to Top]
-
- This is a summary of the changes to the source code that went into this
- release that was generated using the diffstat utility.
-
- apps/app_voicemail.c | 143 +++++++++++++++++++++++++++++++-----------
- cdr/cdr_radius.c | 10 ++
- channels/chan_dahdi.c | 4 -
- channels/chan_sip.c | 1
- configs/features.conf.sample | 2
- configs/voicemail.conf.sample | 9 ++
- include/asterisk/crypto.h | 14 ++--
- main/audiohook.c | 1
- 8 files changed, 135 insertions(+), 49 deletions(-)
-
- ----------------------------------------------------------------------
diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c
index f45e551cb..6d3ff39ac 100644
--- a/cdr/cdr_adaptive_odbc.c
+++ b/cdr/cdr_adaptive_odbc.c
@@ -419,7 +419,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_TYPE_DATE:
{
int year = 0, month = 0, day = 0;
- if (sscanf(colptr, "%d-%d-%d", &year, &month, &day) != 3 || year <= 0 ||
+ if (sscanf(colptr, "%4d-%2d-%2d", &year, &month, &day) != 3 || year <= 0 ||
month <= 0 || month > 12 || day < 0 || day > 31 ||
((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) ||
(month == 2 && year % 400 == 0 && day > 29) ||
@@ -441,7 +441,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_TYPE_TIME:
{
int hour = 0, minute = 0, second = 0;
- int count = sscanf(colptr, "%d:%d:%d", &hour, &minute, &second);
+ int count = sscanf(colptr, "%2d:%2d:%2d", &hour, &minute, &second);
if ((count != 2 && count != 3) || hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59) {
ast_log(LOG_WARNING, "CDR variable %s is not a valid time ('%s').\n", entry->name, colptr);
@@ -457,7 +457,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_TIMESTAMP:
{
int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0;
- int count = sscanf(colptr, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &minute, &second);
+ int count = sscanf(colptr, "%4d-%2d-%2d %2d:%2d:%2d", &year, &month, &day, &hour, &minute, &second);
if ((count != 3 && count != 5 && count != 6) || year <= 0 ||
month <= 0 || month > 12 || day < 0 || day > 31 ||
@@ -482,7 +482,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_INTEGER:
{
int integer = 0;
- if (sscanf(colptr, "%d", &integer) != 1) {
+ if (sscanf(colptr, "%30d", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
break;
}
@@ -495,7 +495,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_BIGINT:
{
long long integer = 0;
- if (sscanf(colptr, "%lld", &integer) != 1) {
+ if (sscanf(colptr, "%30lld", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
break;
}
@@ -508,7 +508,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_SMALLINT:
{
short integer = 0;
- if (sscanf(colptr, "%hd", &integer) != 1) {
+ if (sscanf(colptr, "%30hd", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
break;
}
@@ -521,7 +521,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_TINYINT:
{
char integer = 0;
- if (sscanf(colptr, "%hhd", &integer) != 1) {
+ if (sscanf(colptr, "%30hhd", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
break;
}
@@ -534,7 +534,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_BIT:
{
char integer = 0;
- if (sscanf(colptr, "%hhd", &integer) != 1) {
+ if (sscanf(colptr, "%30hhd", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
break;
}
@@ -550,7 +550,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_DECIMAL:
{
double number = 0.0;
- if (sscanf(colptr, "%lf", &number) != 1) {
+ if (sscanf(colptr, "%30lf", &number) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an numeric type.\n", entry->name);
break;
}
@@ -565,7 +565,7 @@ static int odbc_log(struct ast_cdr *cdr)
case SQL_DOUBLE:
{
double number = 0.0;
- if (sscanf(colptr, "%lf", &number) != 1) {
+ if (sscanf(colptr, "%30lf", &number) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an numeric type.\n", entry->name);
break;
}
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index 11823406e..e9bc7c071 100644
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -240,7 +240,7 @@ static int pgsql_log(struct ast_cdr *cdr)
ast_cdr_getvar(cdr, cur->name, &value, buf, sizeof(buf), 0, 0);
if (strncmp(cur->type, "int", 3) == 0) {
long long whatever;
- if (value && sscanf(value, "%lld", &whatever) == 1) {
+ if (value && sscanf(value, "%30lld", &whatever) == 1) {
LENGTHEN_BUF2(25);
lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%lld", whatever);
} else {
@@ -249,7 +249,7 @@ static int pgsql_log(struct ast_cdr *cdr)
}
} else if (strncmp(cur->type, "float", 5) == 0) {
long double whatever;
- if (value && sscanf(value, "%Lf", &whatever) == 1) {
+ if (value && sscanf(value, "%30Lf", &whatever) == 1) {
LENGTHEN_BUF2(50);
lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%30Lf", whatever);
} else {
@@ -508,7 +508,7 @@ static int config_module(int reload)
ast_verb(4, "Found column '%s' of type '%s'\n", fname, ftype);
cur = ast_calloc(1, sizeof(*cur) + strlen(fname) + strlen(ftype) + 2);
if (cur) {
- sscanf(flen, "%d", &cur->len);
+ sscanf(flen, "%30d", &cur->len);
cur->name = (char *)cur + sizeof(*cur);
cur->type = (char *)cur + sizeof(*cur) + strlen(fname) + 1;
strcpy(cur->name, fname);
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index c703849d3..7800e4a05 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1322,9 +1322,9 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
struct timeval tv;
s = data;
- if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ if ((s[0] == '@') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
- } else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ } else if ((s[0] == ':') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
waitforagent = 1;
} else
@@ -2287,9 +2287,9 @@ static int agent_devicestate(void *data)
int res = AST_DEVICE_INVALID;
s = data;
- if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1))
+ if ((s[0] == '@') && (sscanf(s + 1, "%30d", &groupoff) == 1))
groupmatch = (1 << groupoff);
- else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ else if ((s[0] == ':') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
} else
groupmatch = 0;
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 58de082b7..fafaa9796 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -8443,7 +8443,7 @@ static unsigned int parse_pointcode(const char *pcstring)
unsigned int code1, code2, code3;
int numvals;
- numvals = sscanf(pcstring, "%d-%d-%d", &code1, &code2, &code3);
+ numvals = sscanf(pcstring, "%30d-%30d-%30d", &code1, &code2, &code3);
if (numvals == 1)
return code1;
if (numvals == 3)
@@ -9268,7 +9268,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
stringp = dest + 1;
s = strsep(&stringp, "/");
- if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+ if ((res = sscanf(s, "%30d%1c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine group for data %s\n", (char *)data);
return NULL;
}
@@ -9304,7 +9304,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
channelmatch = x;
}
#ifdef HAVE_PRI
- else if ((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) > 1) {
+ else if ((res = sscanf(s, "%30d:%30d%1c%30d", &trunkgroup, &crv, &opt, &y)) > 1) {
if ((trunkgroup < 1) || (crv < 1)) {
ast_log(LOG_WARNING, "Unable to determine trunk group and CRV for data %s\n", (char *)data);
return NULL;
@@ -9326,8 +9326,8 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
channelmatch = crv;
p = pris[x].crvs;
}
-#endif
- else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+#endif
+ else if ((res = sscanf(s, "%30d%1c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data);
return NULL;
} else {
@@ -12512,7 +12512,7 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli
return CLI_SHOWUSAGE;
#ifdef HAVE_PRI
if ((c = strchr(a->argv[3], ':'))) {
- if (sscanf(a->argv[3], "%d:%d", &trunkgroup, &channel) != 2)
+ if (sscanf(a->argv[3], "%30d:%30d", &trunkgroup, &channel) != 2)
return CLI_SHOWUSAGE;
if ((trunkgroup < 1) || (channel < 1))
return CLI_SHOWUSAGE;
@@ -13787,7 +13787,7 @@ static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *v
#ifdef HAVE_PRI
pri = NULL;
if (iscrv) {
- if (sscanf(c, "%d:%n", &trunkgroup, &y) != 1) {
+ if (sscanf(c, "%30d:%n", &trunkgroup, &y) != 1) {
ast_log(LOG_WARNING, "CRV must begin with trunkgroup followed by a colon at line %d.\n", lineno);
return -1;
}
@@ -13810,9 +13810,9 @@ static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *v
#endif
while ((chan = strsep(&c, ","))) {
- if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
+ if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) {
/* Range */
- } else if (sscanf(chan, "%d", &start)) {
+ } else if (sscanf(chan, "%30d", &start)) {
/* Just one */
finish = start;
} else if (!strcasecmp(chan, "pseudo")) {
@@ -13901,7 +13901,7 @@ static void process_echocancel(struct dahdi_chan_conf *confp, const char *data,
strcpy(confp->chan.echocancel.params[confp->chan.echocancel.head.param_count].name, param.name);
if (param.value) {
- if (sscanf(param.value, "%d", &confp->chan.echocancel.params[confp->chan.echocancel.head.param_count].value) != 1) {
+ if (sscanf(param.value, "%30d", &confp->chan.echocancel.params[confp->chan.echocancel.head.param_count].value) != 1) {
ast_log(LOG_WARNING, "Invalid echocancel parameter value supplied at line %d: '%s'\n", line, param.value);
continue;
}
@@ -13938,7 +13938,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
int res;
char policy[21] = "";
- res = sscanf(v->value, "%d,%20s", &confp->chan.buf_no, policy);
+ res = sscanf(v->value, "%30d,%20s", &confp->chan.buf_no, policy);
if (res != 2) {
ast_log(LOG_WARNING, "Parsing buffers option data failed, using defaults.\n");
confp->chan.buf_no = numbufs;
@@ -13972,11 +13972,11 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
} else if (!strcasecmp(v->name, "dring3range")) {
confp->chan.drings.ringnum[2].range = atoi(v->value);
} else if (!strcasecmp(v->name, "dring1")) {
- sscanf(v->value, "%d,%d,%d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);
+ sscanf(v->value, "%30d,%30d,%30d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);
} else if (!strcasecmp(v->name, "dring2")) {
- sscanf(v->value,"%d,%d,%d", &confp->chan.drings.ringnum[1].ring[0], &confp->chan.drings.ringnum[1].ring[1], &confp->chan.drings.ringnum[1].ring[2]);
+ sscanf(v->value, "%30d,%30d,%30d", &confp->chan.drings.ringnum[1].ring[0], &confp->chan.drings.ringnum[1].ring[1], &confp->chan.drings.ringnum[1].ring[2]);
} else if (!strcasecmp(v->name, "dring3")) {
- sscanf(v->value, "%d,%d,%d", &confp->chan.drings.ringnum[2].ring[0], &confp->chan.drings.ringnum[2].ring[1], &confp->chan.drings.ringnum[2].ring[2]);
+ sscanf(v->value, "%30d,%30d,%30d", &confp->chan.drings.ringnum[2].ring[0], &confp->chan.drings.ringnum[2].ring[1], &confp->chan.drings.ringnum[2].ring[2]);
} else if (!strcasecmp(v->name, "usecallerid")) {
confp->chan.use_callerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "cidsignalling")) {
@@ -14029,7 +14029,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
} else if (!strcasecmp(v->name, "busycount")) {
confp->chan.busycount = atoi(v->value);
} else if (!strcasecmp(v->name, "busypattern")) {
- if (sscanf(v->value, "%d,%d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
+ if (sscanf(v->value, "%30d,%30d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength at line %d.\n", v->lineno);
}
} else if (!strcasecmp(v->name, "callprogress")) {
@@ -14047,7 +14047,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
} else if (!strcasecmp(v->name, "echocancel")) {
process_echocancel(confp, v->value, v->lineno);
} else if (!strcasecmp(v->name, "echotraining")) {
- if (sscanf(v->value, "%d", &y) == 1) {
+ if (sscanf(v->value, "%30d", &y) == 1) {
if ((y < 10) || (y > 4000)) {
ast_log(LOG_WARNING, "Echo training time must be within the range of 10 to 4000 ms at line %d.\n", v->lineno);
} else {
@@ -14123,19 +14123,19 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
confp->chan.mwimonitor_fsk = ast_true(v->value) ? 1 : 0;
}
} else if (!strcasecmp(v->name, "cid_rxgain")) {
- if (sscanf(v->value, "%f", &confp->chan.cid_rxgain) != 1) {
+ if (sscanf(v->value, "%30f", &confp->chan.cid_rxgain) != 1) {
ast_log(LOG_WARNING, "Invalid cid_rxgain: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "rxgain")) {
- if (sscanf(v->value, "%f", &confp->chan.rxgain) != 1) {
+ if (sscanf(v->value, "%30f", &confp->chan.rxgain) != 1) {
ast_log(LOG_WARNING, "Invalid rxgain: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "txgain")) {
- if (sscanf(v->value, "%f", &confp->chan.txgain) != 1) {
+ if (sscanf(v->value, "%30f", &confp->chan.txgain) != 1) {
ast_log(LOG_WARNING, "Invalid txgain: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "tonezone")) {
- if (sscanf(v->value, "%d", &confp->chan.tonezone) != 1) {
+ if (sscanf(v->value, "%30d", &confp->chan.tonezone) != 1) {
ast_log(LOG_WARNING, "Invalid tonezone: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "callerid")) {
@@ -14572,7 +14572,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
ast_copy_string(original_args, v->value, sizeof(original_args));
/* 16 cadences allowed (8 pairs) */
- element_count = sscanf(v->value, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
+ element_count = sscanf(v->value, "%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
/* Cadence must be even (on/off) */
if (element_count % 2 == 1) {
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 95f2ba20d..13814aa8a 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -10733,18 +10733,18 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
peer->maxms = 0;
}
} else if (!strcasecmp(v->name, "qualifysmoothing")) {
peer->smoothing = ast_true(v->value);
} else if (!strcasecmp(v->name, "qualifyfreqok")) {
- if (sscanf(v->value, "%d", &peer->pokefreqok) != 1) {
+ if (sscanf(v->value, "%30d", &peer->pokefreqok) != 1) {
ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when OK should a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
}
} else if (!strcasecmp(v->name, "qualifyfreqnotok")) {
- if (sscanf(v->value, "%d", &peer->pokefreqnotok) != 1) {
+ if (sscanf(v->value, "%30d", &peer->pokefreqnotok) != 1) {
ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when NOT OK should be a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
} else ast_log(LOG_WARNING, "Set peer->pokefreqnotok to %d\n", peer->pokefreqnotok);
} else if (!strcasecmp(v->name, "timezone")) {
@@ -11326,7 +11326,7 @@ static int set_config(char *config_file, int reload)
if (trunkmaxsize == 0)
trunkmaxsize = MAX_TRUNKDATA;
} else if (!strcasecmp(v->name, "autokill")) {
- if (sscanf(v->value, "%d", &x) == 1) {
+ if (sscanf(v->value, "%30d", &x) == 1) {
if (x >= 0)
autokill = x;
else
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 887fdcfd0..067bc13d7 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1890,7 +1890,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c);
return -1;
}
- if (sscanf(m, "audio %d RTP/AVP %n", &portno, &len) != 1) {
+ if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1) {
ast_log(LOG_WARNING, "Unable to determine port number for RTP in '%s'\n", m);
return -1;
}
@@ -1905,7 +1905,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_rtp_pt_clear(sub->rtp);
codecs = ast_strdupa(m + len);
while (!ast_strlen_zero(codecs)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
if (codec_count)
break;
ast_log(LOG_WARNING, "Error in codec string '%s' at '%s'\n", m, codecs);
@@ -1921,7 +1921,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
sdpLineNum_iterator_init(&iterator);
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
char* mimeSubtype = ast_strdupa(a); /* ensures we have enough space */
- if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2)
+ if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) != 2)
continue;
/* Note: should really look at the 'freq' and '#chans' params too */
ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype, 0);
@@ -2054,7 +2054,7 @@ static int transmit_response(struct mgcp_subchannel *sub, char *msg, struct mgcp
mgr = ast_calloc(1, sizeof(*mgr) + resp.len + 1);
if (mgr) {
/* Store MGCP response in case we have to retransmit */
- sscanf(req->identifier, "%d", &mgr->seqno);
+ sscanf(req->identifier, "%30d", &mgr->seqno);
time(&mgr->whensent);
mgr->len = resp.len;
memcpy(mgr->buf, resp.data, resp.len);
@@ -3287,7 +3287,7 @@ static int find_and_retrans(struct mgcp_subchannel *sub, struct mgcp_request *re
time_t now;
struct mgcp_response *prev = NULL, *cur, *next, *answer=NULL;
time(&now);
- if (sscanf(req->identifier, "%d", &seqno) != 1)
+ if (sscanf(req->identifier, "%30d", &seqno) != 1)
seqno = 0;
cur = sub->parent->parent->responses;
while(cur) {
@@ -3345,7 +3345,7 @@ static int mgcpsock_read(int *id, int fd, short events, void *ignore)
return 1;
}
- if (sscanf(req.verb, "%d", &result) && sscanf(req.identifier, "%d", &ident)) {
+ if (sscanf(req.verb, "%30d", &result) && sscanf(req.identifier, "%30d", &ident)) {
/* Try to find who this message is for, if it's important */
sub = find_subchannel_and_lock(NULL, ident, &sin);
if (sub) {
@@ -4162,7 +4162,7 @@ static int reload_config(int reload)
if (ast_str2cos(v->value, &cos_audio))
ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "port")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%5d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
} else {
ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index d325ebc4b..2170cecf0 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -1232,7 +1232,7 @@ static char *handle_cli_misdn_show_config(struct ast_cli_entry *e, int cmd, stru
ok = 1;
}
return ok ? CLI_SUCCESS : CLI_SHOWUSAGE;
- } else if (!sscanf(a->argv[3], "%d", &onlyport) || onlyport < 0) {
+ } else if (!sscanf(a->argv[3], "%5d", &onlyport) || onlyport < 0) {
ast_cli(a->fd, "Unknown option: %s\n", a->argv[3]);
return CLI_SHOWUSAGE;
}
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index c49b81d51..c9c0c7d4a 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1231,7 +1231,7 @@ static char *console_active(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
static void store_boost(struct chan_oss_pvt *o, const char *s)
{
double boost = 0;
- if (sscanf(s, "%lf", &boost) != 1) {
+ if (sscanf(s, "%30lf", &boost) != 1) {
ast_log(LOG_WARNING, "invalid boost <%s>\n", s);
return;
}
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 782218b1d..7a767fa03 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -1259,7 +1259,7 @@ static int parse_gain_value(const char *gain_type, const char *value)
float gain;
/* try to scan number */
- if (sscanf(value, "%f", &gain) != 1)
+ if (sscanf(value, "%30f", &gain) != 1)
{
ast_log(LOG_ERROR, "Invalid %s value '%s' in '%s' config\n",
value, gain_type, config);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ce7116b28..c037e653f 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2267,7 +2267,7 @@ static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_sessi
req.len = strlen(req.data);
}
parse_copy(&reqcpy, &req);
- if (sscanf(get_header(&reqcpy, "Content-Length"), "%d", &cl)) {
+ if (sscanf(get_header(&reqcpy, "Content-Length"), "%30d", &cl)) {
while (cl > 0) {
ast_mutex_lock(&tcptls_session->lock);
if (!fread(buf, (cl < sizeof(buf)) ? cl : sizeof(buf), 1, tcptls_session->f)) {
@@ -6452,7 +6452,7 @@ static int find_sdp(struct sip_request *req)
content_length = get_header(req, "Content-Length");
if (!ast_strlen_zero(content_length)) {
- if (sscanf(content_length, "%ud", &x) != 1) {
+ if (sscanf(content_length, "%30u", &x) != 1) {
ast_log(LOG_WARNING, "Invalid Content-Length: %s\n", content_length);
return 0;
}
@@ -6652,7 +6652,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_log(LOG_WARNING, "SDP sytax error in o= line\n");
return -1;
}
- if (!sscanf(token, "%" SCNu64, &rua_version)) {
+ if (!sscanf(token, "%30" SCNu64, &rua_version)) {
ast_log(LOG_WARNING, "SDP sytax error in o= line version\n");
return -1;
}
@@ -6710,15 +6710,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
numberofports = 1;
len = -1;
- if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
+ if ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
audio = TRUE;
numberofmediastreams++;
/* Found audio stream in this media definition */
portno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -6726,15 +6726,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_verbose("Found RTP audio format %d\n", codec);
ast_rtp_set_m_type(newaudiortp, codec);
}
- } else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1 && len >= 0)) {
+ } else if ((sscanf(m, "video %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1 && len >= 0)) {
video = TRUE;
p->novideo = FALSE;
numberofmediastreams++;
vportno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -6742,15 +6742,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_verbose("Found RTP video format %d\n", codec);
ast_rtp_set_m_type(newvideortp, codec);
}
- } else if ((sscanf(m, "text %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "text %d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
+ } else if ((sscanf(m, "text %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "text %30d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
text = TRUE;
p->notext = FALSE;
numberofmediastreams++;
tportno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -6758,8 +6758,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_verbose("Found RTP text format %d\n", codec);
ast_rtp_set_m_type(newtextrtp, codec);
}
- } else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1 && len > 0) ||
- (sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
+ } else if (p->udptl && ( (sscanf(m, "image %30d udptl t38%n", &x, &len) == 1 && len > 0) ||
+ (sscanf(m, "image %30d UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
if (debug)
ast_verbose("Got T.38 offer in SDP in dialog %s\n", p->callid);
udptlportno = x;
@@ -6946,7 +6946,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_rtp_codec_setpref(p->rtp, pref);
}
continue;
- } else if (sscanf(a, "rtpmap: %u %127[^/]/", &codec, mimeSubtype) == 2) {
+ } else if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) == 2) {
/* We have a rtpmap to handle */
if (last_rtpmap_codec < SDP_MAX_RTPMAP_CODECS) {
@@ -6997,10 +6997,10 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
/* Scan trough the a= lines for T38 attributes and set apropriate fileds */
iterator = req->sdp_start;
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
- if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
+ if ((sscanf(a, "T38FaxMaxBuffer:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "MaxBufferSize:%d\n", x);
- } else if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1) || (sscanf(a, "T38FaxMaxRate:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38MaxBitRate:%30d", &x) == 1) || (sscanf(a, "T38FaxMaxRate:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "T38MaxBitRate: %d\n", x);
switch (x) {
@@ -7023,21 +7023,21 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
peert38capability |= T38FAX_RATE_2400;
break;
}
- } else if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38FaxVersion:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "FaxVersion: %d\n", x);
if (x == 0)
peert38capability |= T38FAX_VERSION_0;
else if (x == 1)
peert38capability |= T38FAX_VERSION_1;
- } else if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1) || (sscanf(a, "T38MaxDatagram:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38FaxMaxDatagram:%30d", &x) == 1) || (sscanf(a, "T38MaxDatagram:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "FaxMaxDatagram: %d\n", x);
ast_udptl_set_far_max_datagram(p->udptl, x);
ast_udptl_set_local_max_datagram(p->udptl, x);
} else if ((strncmp(a, "T38FaxFillBitRemoval", 20) == 0)) {
found = 1;
- if(sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1) {
+ if(sscanf(a, "T38FaxFillBitRemoval:%30d", &x) == 1) {
ast_debug(3, "FillBitRemoval: %d\n", x);
if(x == 1)
peert38capability |= T38FAX_FILL_BIT_REMOVAL;
@@ -7047,7 +7047,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
}
} else if ((strncmp(a, "T38FaxTranscodingMMR", 20) == 0)) {
found = 1;
- if(sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1) {
+ if(sscanf(a, "T38FaxTranscodingMMR:%30d", &x) == 1) {
ast_debug(3, "Transcoding MMR: %d\n", x);
if(x == 1)
peert38capability |= T38FAX_TRANSCODING_MMR;
@@ -7057,7 +7057,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
}
} else if ((strncmp(a, "T38FaxTranscodingJBIG", 21) == 0)) {
found = 1;
- if(sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1) {
+ if(sscanf(a, "T38FaxTranscodingJBIG:%30d", &x) == 1) {
ast_debug(3, "Transcoding JBIG: %d\n", x);
if(x == 1)
peert38capability |= T38FAX_TRANSCODING_JBIG;
@@ -7816,7 +7816,7 @@ static int __transmit_response(struct sip_pvt *p, const char *msg, const struct
struct sip_request resp;
int seqno = 0;
- if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+ if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -7984,7 +7984,7 @@ static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, const
char tmp[512];
int seqno = 0;
- if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+ if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -8626,7 +8626,7 @@ static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct s
struct sip_request resp;
int seqno;
- if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) {
+ if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -8665,7 +8665,7 @@ static int transmit_response_with_sdp(struct sip_pvt *p, const char *msg, const
{
struct sip_request resp;
int seqno;
- if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) {
+ if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -10128,7 +10128,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
char *s = strcasestr(contact, ";expires=");
if (s) {
expires = strsep(&s, ";"); /* trim ; and beyond */
- if (sscanf(expires + 9, "%d", &expiry) != 1)
+ if (sscanf(expires + 9, "%30d", &expiry) != 1)
expiry = default_expiry;
} else {
/* Nothing has been specified */
@@ -14685,7 +14685,7 @@ static int func_header_read(struct ast_channel *chan, const char *function, char
if (!args.number) {
number = 1;
} else {
- sscanf(args.number, "%d", &number);
+ sscanf(args.number, "%30d", &number);
if (number < 1)
number = 1;
}
@@ -15543,7 +15543,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
}
tmptmp = strcasestr(contact, "expires=");
if (tmptmp) {
- if (sscanf(tmptmp + 8, "%d;", &expires) != 1)
+ if (sscanf(tmptmp + 8, "%30d;", &expires) != 1)
expires = 0;
}
@@ -18639,7 +18639,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so
ast_log(LOG_ERROR, "Missing Cseq. Dropping this SIP message, it's incomplete.\n");
error = 1;
}
- if (!error && sscanf(cseq, "%d%n", &seqno, &len) != 1) {
+ if (!error && sscanf(cseq, "%30d%n", &seqno, &len) != 1) {
ast_log(LOG_ERROR, "No seqno in '%s'. Dropping incomplete message.\n", cmd);
error = 1;
}
@@ -18666,6 +18666,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so
* possibly process the request. In all cases, there function
* terminates at the end of this block
*/
+<<<<<<< .working
int ret = 0;
if (p->ocseq < seqno && seqno != p->lastnoninvite) {
@@ -18693,6 +18694,26 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so
if ((respid == 200) || ((respid >= 300) && (respid <= 399)))
extract_uri(p, req);
handle_response(p, respid, e + len, req, seqno);
+=======
+ if (ast_strlen_zero(e)) {
+ return 0;
+ }
+ if (sscanf(e, "%30d %n", &respid, &len) != 1) {
+ ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
+ return 0;
+ }
+ if (respid <= 0) {
+ ast_log(LOG_WARNING, "Invalid SIP response code: '%d'\n", respid);
+ return 0;
+ }
+ if (p->ocseq && (p->ocseq < seqno)) {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
+ return -1;
+ } else {
+ if ((respid == 200) || ((respid >= 300) && (respid <= 399))) {
+ extract_uri(p, req);
+>>>>>>> .merge-right.r211551
}
}
return 0;
@@ -19203,7 +19224,7 @@ static int sip_parse_host(char *line, int lineno, char **hostname, int *portnum,
if ((port = strrchr(line, ':'))) {
*port++ = '\0';
- if (!sscanf(port, "%u", portnum)) {
+ if (!sscanf(port, "%5u", portnum)) {
ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", port, lineno);
port = NULL;
}
@@ -19610,7 +19631,7 @@ int parse_minse (const char *p_hdrval, int *const p_interval)
*p_interval = 0;
p_hdrval = ast_skip_blanks(p_hdrval);
- if (!sscanf(p_hdrval, "%d", p_interval)) {
+ if (!sscanf(p_hdrval, "%30d", p_interval)) {
ast_log(LOG_WARNING, "Parsing of Min-SE header failed %s\n", p_hdrval);
return -1;
}
@@ -19640,7 +19661,7 @@ int parse_session_expires(const char *p_hdrval, int *const p_interval, enum st_r
while ((p_token = strsep(&p_se_hdr, ";"))) {
p_token = ast_skip_blanks(p_token);
- if (!sscanf(p_token, "%d", p_interval)) {
+ if (!sscanf(p_token, "%30d", p_interval)) {
ast_log(LOG_WARNING, "Parsing of Session-Expires failed\n");
return -1;
}
@@ -20605,19 +20626,19 @@ static struct sip_user *build_user(const char *name, struct ast_variable *v, str
user->stimer.st_mode_oper = i;
}
} else if (!strcasecmp(v->name, "session-expires")) {
- if (sscanf(v->value, "%d", &user->stimer.st_max_se) != 1) {
+ if (sscanf(v->value, "%30d", &user->stimer.st_max_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-expires '%s' at line %d of %s\n", v->value, v->lineno, config);
user->stimer.st_max_se = global_max_se;
- }
+ }
} else if (!strcasecmp(v->name, "session-minse")) {
- if (sscanf(v->value, "%d", &user->stimer.st_min_se) != 1) {
+ if (sscanf(v->value, "%30d", &user->stimer.st_min_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-minse '%s' at line %d of %s\n", v->value, v->lineno, config);
user->stimer.st_min_se = global_min_se;
- }
+ }
if (user->stimer.st_min_se < 90) {
ast_log(LOG_WARNING, "session-minse '%s' at line %d of %s is not allowed to be < 90 secs\n", v->value, v->lineno, config);
user->stimer.st_min_se = global_min_se;
- }
+ }
} else if (!strcasecmp(v->name, "session-refresher")) {
int i = (int) str2strefresher(v->value);
if (i < 0) {
@@ -20829,7 +20850,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
} else if (realtime && !strcasecmp(v->name, "regseconds")) {
ast_get_time_t(v->value, &regseconds, 0, NULL);
} else if (realtime && !strcasecmp(v->name, "lastms")) {
- sscanf(v->value, "%d", &peer->lastms);
+ sscanf(v->value, "%30d", &peer->lastms);
} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
inet_aton(v->value, &(peer->addr.sin_addr));
} else if (realtime && !strcasecmp(v->name, "name"))
@@ -21000,22 +21021,22 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
} else if (!strcasecmp(v->name, "autoframing")) {
peer->autoframing = ast_true(v->value);
} else if (!strcasecmp(v->name, "rtptimeout")) {
- if ((sscanf(v->value, "%d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
peer->rtptimeout = global_rtptimeout;
}
} else if (!strcasecmp(v->name, "rtpholdtimeout")) {
- if ((sscanf(v->value, "%d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
peer->rtpholdtimeout = global_rtpholdtimeout;
}
} else if (!strcasecmp(v->name, "rtpkeepalive")) {
- if ((sscanf(v->value, "%d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
peer->rtpkeepalive = global_rtpkeepalive;
}
} else if (!strcasecmp(v->name, "timert1")) {
- if ((sscanf(v->value, "%d", &peer->timer_t1) != 1) || (peer->timer_t1 < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->timer_t1) != 1) || (peer->timer_t1 < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid T1 time at line %d. Using default.\n", v->value, v->lineno);
peer->timer_t1 = global_t1;
}
@@ -21025,7 +21046,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->timer_b = peer->timer_t1 * 64;
}
} else if (!strcasecmp(v->name, "timerb")) {
- if ((sscanf(v->value, "%d", &peer->timer_b) != 1) || (peer->timer_b < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->timer_b) != 1) || (peer->timer_b < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid Timer B time at line %d. Using default.\n", v->value, v->lineno);
peer->timer_b = global_timer_b;
}
@@ -21042,7 +21063,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = default_qualify ? default_qualify : DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno);
peer->maxms = 0;
}
@@ -21056,7 +21077,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
}
} else if (!strcasecmp(v->name, "qualifyfreq")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1)
+ if (sscanf(v->value, "%30d", &i) == 1)
peer->qualifyfreq = i * 1000;
else {
ast_log(LOG_WARNING, "Invalid qualifyfreq number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -21075,12 +21096,12 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->stimer.st_mode_oper = i;
}
} else if (!strcasecmp(v->name, "session-expires")) {
- if (sscanf(v->value, "%d", &peer->stimer.st_max_se) != 1) {
+ if (sscanf(v->value, "%30d", &peer->stimer.st_max_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-expires '%s' at line %d of %s\n", v->value, v->lineno, config);
peer->stimer.st_max_se = global_max_se;
}
} else if (!strcasecmp(v->name, "session-minse")) {
- if (sscanf(v->value, "%d", &peer->stimer.st_min_se) != 1) {
+ if (sscanf(v->value, "%30d", &peer->stimer.st_min_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-minse '%s' at line %d of %s\n", v->value, v->lineno, config);
peer->stimer.st_min_se = global_min_se;
}
@@ -21489,17 +21510,17 @@ static int reload_config(enum channelreloadreason reason)
} else if (!strcasecmp(v->name, "vmexten")) {
ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten));
} else if (!strcasecmp(v->name, "rtptimeout")) {
- if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtptimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpholdtimeout")) {
- if ((sscanf(v->value, "%d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtpholdtimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpkeepalive")) {
- if ((sscanf(v->value, "%d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
global_rtpkeepalive = 0;
}
@@ -21637,7 +21658,7 @@ static int reload_config(enum channelreloadreason reason)
if (!externip.sin_port)
externip.sin_port = bindaddr.sin_port;
} else if (!strcasecmp(v->name, "externrefresh")) {
- if (sscanf(v->value, "%d", &externrefresh) != 1) {
+ if (sscanf(v->value, "%30d", &externrefresh) != 1) {
ast_log(LOG_WARNING, "Invalid externrefresh value '%s', must be an integer >0 at line %d\n", v->value, v->lineno);
externrefresh = 10;
}
@@ -21697,7 +21718,7 @@ static int reload_config(enum channelreloadreason reason)
ast_log(LOG_WARNING, "Invalid cos_text value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "bindport")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1) {
+ if (sscanf(v->value, "%5d", &i) == 1) {
bindaddr.sin_port = htons(i);
} else {
ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -21707,13 +21728,13 @@ static int reload_config(enum channelreloadreason reason)
default_qualify = 0;
} else if (!strcasecmp(v->value, "yes")) {
default_qualify = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &default_qualify) != 1) {
+ } else if (sscanf(v->value, "%30d", &default_qualify) != 1) {
ast_log(LOG_WARNING, "Qualification default should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", v->lineno);
default_qualify = 0;
}
} else if (!strcasecmp(v->name, "qualifyfreq")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1)
+ if (sscanf(v->value, "%30d", &i) == 1)
global_qualifyfreq = i * 1000;
else {
ast_log(LOG_WARNING, "Invalid qualifyfreq number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -21736,12 +21757,12 @@ static int reload_config(enum channelreloadreason reason)
global_st_mode = i;
}
} else if (!strcasecmp(v->name, "session-expires")) {
- if (sscanf(v->value, "%d", &global_max_se) != 1) {
+ if (sscanf(v->value, "%30d", &global_max_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-expires '%s' at line %d of %s\n", v->value, v->lineno, config);
global_max_se = DEFAULT_MAX_SE;
}
} else if (!strcasecmp(v->name, "session-minse")) {
- if (sscanf(v->value, "%d", &global_min_se) != 1) {
+ if (sscanf(v->value, "%30d", &global_min_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-minse '%s' at line %d of %s\n", v->value, v->lineno, config);
global_min_se = DEFAULT_MIN_SE;
}
@@ -22329,7 +22350,7 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
memset(lport, 0, sizeof(lport));
localtmp++;
/* This is okey because lhost and lport are as big as tmp */
- sscanf(localtmp, "%[^<>:; ]:%[^<>:; ]", lhost, lport);
+ sscanf(localtmp, "%80[^<>:; ]:%80[^<>:; ]", lhost, lport);
if (ast_strlen_zero(lhost)) {
ast_log(LOG_ERROR, "Can't find the host address\n");
return 0;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 7cf9a7faa..35b7e62fd 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -5946,7 +5946,7 @@ static int reload_config(void)
} else if (!strcasecmp(v->name, "disallow")) {
ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 0);
} else if (!strcasecmp(v->name, "bindport")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%5d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
} else {
ast_log(LOG_WARNING, "Invalid bindport '%s' at line %d of %s\n", v->value, v->lineno, config);
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
index 11d297ff9..975bf72f2 100644
--- a/channels/chan_usbradio.c
+++ b/channels/chan_usbradio.c
@@ -259,8 +259,8 @@ END_CONFIG
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
-static char *config = "usbradio.conf"; /* default config file */
-static char *config1 = "usbradio_tune.conf"; /* tune config file */
+static const char *config = "usbradio.conf"; /* default config file */
+static const char *config1 = "usbradio_tune.conf"; /* tune config file */
static FILE *frxcapraw = NULL, *frxcaptrace = NULL, *frxoutraw = NULL;
static FILE *ftxcapraw = NULL, *ftxcaptrace = NULL, *ftxoutraw = NULL;
@@ -1797,7 +1797,7 @@ static void store_rxsdtype(struct chan_usbradio_pvt *o, const char *s)
static void store_rxgain(struct chan_usbradio_pvt *o, const char *s)
{
float f;
- if (sscanf(s, "%f", &f) == 1)
+ if (sscanf(s, "%30f", &f) == 1)
o->rxgain = f;
ast_debug(4, "set rxgain = %f\n", f);
}
@@ -1805,7 +1805,7 @@ static void store_rxgain(struct chan_usbradio_pvt *o, const char *s)
static void store_rxvoiceadj(struct chan_usbradio_pvt *o, const char *s)
{
float f;
- if (sscanf(s, "%f", &f) == 1)
+ if (sscanf(s, "%30f", &f) == 1)
o->rxvoiceadj = f;
ast_debug(4, "set rxvoiceadj = %f\n", f);
}
@@ -1813,7 +1813,7 @@ static void store_rxvoiceadj(struct chan_usbradio_pvt *o, const char *s)
static void store_rxctcssadj(struct chan_usbradio_pvt *o, const char *s)
{
float f;
- if (sscanf(s, "%f", &f) == 1)
+ if (sscanf(s, "%30f", &f) == 1)
o->rxctcssadj = f;
ast_debug(4, "set rxctcssadj = %f\n", f);
}
diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c
index b56e7798b..8d2dfd9f2 100644
--- a/channels/iax2-provision.c
+++ b/channels/iax2-provision.c
@@ -261,7 +261,7 @@ int iax_provision_version(unsigned int *version, const char *template, int force
ast_mutex_lock(&provlock);
ast_db_get("iax/provisioning/cache", template, tmp, sizeof(tmp));
- if (sscanf(tmp, "v%x", version) != 1) {
+ if (sscanf(tmp, "v%30x", version) != 1) {
if (strcmp(tmp, "u")) {
ret = iax_provision_build(&ied, version, template, force);
if (ret)
@@ -319,7 +319,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
v = ast_variable_browse(cfg, s);
while(v) {
if (!strcasecmp(v->name, "port") || !strcasecmp(v->name, "serverport")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < 65535)) {
+ if ((sscanf(v->value, "%5d", &x) == 1) && (x > 0) && (x < 65535)) {
if (!strcasecmp(v->name, "port")) {
cur->port = x;
foundportno = 1;
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index 1db51f94f..20ed2e352 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -889,9 +889,9 @@ static int _parse (union misdn_cfg_pt *dest, const char *value, enum misdn_cfg_t
int res;
if (strchr(value,'x')) {
- res = sscanf(value, "%x", &tmp);
+ res = sscanf(value, "%30x", &tmp);
} else {
- res = sscanf(value, "%d", &tmp);
+ res = sscanf(value, "%30d", &tmp);
}
if (res) {
dest->num = ast_malloc(sizeof(int));
@@ -906,7 +906,7 @@ static int _parse (union misdn_cfg_pt *dest, const char *value, enum misdn_cfg_t
break;
case MISDN_CTYPE_BOOLINT:
dest->num = ast_malloc(sizeof(int));
- if (sscanf(value, "%d", &tmp)) {
+ if (sscanf(value, "%30d", &tmp)) {
memcpy(dest->num, &tmp, sizeof(int));
} else {
*(dest->num) = (ast_true(value) ? boolint_def : 0);
@@ -975,7 +975,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
for (token = strsep(&tmp, ","); token; token = strsep(&tmp, ","), *ptpbuf = 0) {
if (!*token)
continue;
- if (sscanf(token, "%d-%d%s", &start, &end, ptpbuf) >= 2) {
+ if (sscanf(token, "%30d-%30d%511s", &start, &end, ptpbuf) >= 2) {
for (; start <= end; start++) {
if (start <= max_ports && start > 0) {
cfg_for_ports[start] = 1;
@@ -984,7 +984,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
CLI_ERROR(v->name, v->value, cat);
}
} else {
- if (sscanf(token, "%d%s", &start, ptpbuf)) {
+ if (sscanf(token, "%30d%511s", &start, ptpbuf)) {
if (start <= max_ports && start > 0) {
cfg_for_ports[start] = 1;
ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0;
diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c
index 494693182..6d8b4544b 100644
--- a/codecs/codec_speex.c
+++ b/codecs/codec_speex.c
@@ -396,7 +396,7 @@ static int parse_config(int reload)
} else
ast_log(LOG_ERROR,"Error! Complexity must be 0-10\n");
} else if (!strcasecmp(var->name, "vbr_quality")) {
- if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0 && res_f <= 10) {
+ if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0 && res_f <= 10) {
ast_verb(3, "CODEC SPEEX: Setting VBR Quality to %f\n",res_f);
vbr_quality = res_f;
} else
@@ -435,7 +435,7 @@ static int parse_config(int reload)
pp_agc = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
} else if (!strcasecmp(var->name, "pp_agc_level")) {
- if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) {
+ if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
ast_verb(3, "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
pp_agc_level = res_f;
} else
@@ -447,13 +447,13 @@ static int parse_config(int reload)
pp_dereverb = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
} else if (!strcasecmp(var->name, "pp_dereverb_decay")) {
- if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) {
+ if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
pp_dereverb_decay = res_f;
} else
ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Decay must be >= 0\n");
} else if (!strcasecmp(var->name, "pp_dereverb_level")) {
- if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) {
+ if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
pp_dereverb_level = res_f;
} else
diff --git a/doc/CODING-GUIDELINES b/doc/CODING-GUIDELINES
index 3050a507c..44063bd1f 100644
--- a/doc/CODING-GUIDELINES
+++ b/doc/CODING-GUIDELINES
@@ -370,6 +370,18 @@ you wish to put into it (even if you did not allocate the buffer yourself),
use a direct strcpy(), as it can be inlined and optimized to simple
processor operations, unlike ast_copy_string().
+* String conversions
+--------------------
+
+When converting from strings to integers or floats, use the sscanf function
+in preference to the atoi and atof family of functions, as sscanf detects
+errors. Always check the return value of sscanf to verify that your numeric
+variables successfully scanned before using them. Also, to avoid a potential
+libc bug, always specify a maximum width for each conversion specifier,
+including integers and floats. A good length for both integers and floats is
+30, as this is more than generous, even if you're using doubles or long
+integers.
+
* Use of functions
------------------
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index e8373c5e5..3041f5bd7 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -136,10 +136,10 @@ static int func_channel_write(struct ast_channel *chan, const char *function,
} else if (!strcasecmp(data, "callgroup"))
chan->callgroup = ast_get_group(value);
else if (!strcasecmp(data, "txgain")) {
- sscanf(value, "%hhd", &gainset);
+ sscanf(value, "%4hhd", &gainset);
ast_channel_setoption(chan, AST_OPTION_TXGAIN, &gainset, sizeof(gainset), 0);
} else if (!strcasecmp(data, "rxgain")) {
- sscanf(value, "%hhd", &gainset);
+ sscanf(value, "%4hhd", &gainset);
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &gainset, sizeof(gainset), 0);
} else if (!strcasecmp(data, "transfercapability")) {
unsigned short i;
diff --git a/funcs/func_cut.c b/funcs/func_cut.c
index 231729ddf..2a4eb371e 100644
--- a/funcs/func_cut.c
+++ b/funcs/func_cut.c
@@ -89,7 +89,7 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz
}
*ptrvalue++ = '\0';
sortable_keys[count2].key = ptrkey;
- sscanf(ptrvalue, "%f", &sortable_keys[count2].value);
+ sscanf(ptrvalue, "%30f", &sortable_keys[count2].value);
count2++;
}
@@ -153,15 +153,15 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
int num1 = 0, num2 = MAXRESULT;
char trashchar;
- if (sscanf(nextgroup, "%d-%d", &num1, &num2) == 2) {
+ if (sscanf(nextgroup, "%30d-%30d", &num1, &num2) == 2) {
/* range with both start and end */
- } else if (sscanf(nextgroup, "-%d", &num2) == 1) {
+ } else if (sscanf(nextgroup, "-%30d", &num2) == 1) {
/* range with end */
num1 = 0;
- } else if ((sscanf(nextgroup, "%d%c", &num1, &trashchar) == 2) && (trashchar == '-')) {
+ } else if ((sscanf(nextgroup, "%30d%1c", &num1, &trashchar) == 2) && (trashchar == '-')) {
/* range with start */
num2 = MAXRESULT;
- } else if (sscanf(nextgroup, "%d", &num1) == 1) {
+ } else if (sscanf(nextgroup, "%30d", &num1) == 1) {
/* single number */
num2 = num1;
} else {
diff --git a/funcs/func_dialplan.c b/funcs/func_dialplan.c
index 6d4c488f6..766b3c4c4 100644
--- a/funcs/func_dialplan.c
+++ b/funcs/func_dialplan.c
@@ -55,7 +55,7 @@ static int isexten_function_read(struct ast_channel *chan, const char *cmd, char
if (!ast_strlen_zero(args.priority)) {
int priority_num;
- if (sscanf(args.priority, "%d", &priority_num) == 1 && priority_num > 0) {
+ if (sscanf(args.priority, "%30d", &priority_num) == 1 && priority_num > 0) {
int res;
res = ast_exists_extension(chan, args.context, args.exten, priority_num,
chan->cid.cid_num);
diff --git a/funcs/func_enum.c b/funcs/func_enum.c
index e1c29cbfc..afeba457b 100644
--- a/funcs/func_enum.c
+++ b/funcs/func_enum.c
@@ -258,7 +258,7 @@ static int enum_result_read(struct ast_channel *chan, const char *cmd, char *dat
goto finish;
}
- if (sscanf(args.resultnum, "%u", &num) != 1) {
+ if (sscanf(args.resultnum, "%30u", &num) != 1) {
ast_log(LOG_ERROR, "Invalid value '%s' for resultnum to ENUMRESULT!\n", args.resultnum);
goto finish;
}
diff --git a/funcs/func_math.c b/funcs/func_math.c
index 45036d5ad..663cc5daf 100644
--- a/funcs/func_math.c
+++ b/funcs/func_math.c
@@ -190,12 +190,12 @@ static int math(struct ast_channel *chan, const char *cmd, char *parse,
return -1;
}
- if (sscanf(mvalue1, "%lf", &fnum1) != 1) {
+ if (sscanf(mvalue1, "%30lf", &fnum1) != 1) {
ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue1);
return -1;
}
- if (sscanf(mvalue2, "%lf", &fnum2) != 1) {
+ if (sscanf(mvalue2, "%30lf", &fnum2) != 1) {
ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue2);
return -1;
}
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c
index c8e8760e6..a7c747ada 100644
--- a/funcs/func_odbc.c
+++ b/funcs/func_odbc.c
@@ -671,7 +671,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
if (strcasecmp(tmp, "multirow") == 0)
ast_set_flag((*query), OPT_MULTIROW);
if ((tmp = ast_variable_retrieve(cfg, catg, "rowlimit")))
- sscanf(tmp, "%d", &((*query)->rowlimit));
+ sscanf(tmp, "%30d", &((*query)->rowlimit));
}
(*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function));
diff --git a/funcs/func_rand.c b/funcs/func_rand.c
index a3db21d26..57bd30fe9 100644
--- a/funcs/func_rand.c
+++ b/funcs/func_rand.c
@@ -45,10 +45,10 @@ static int acf_rand_exec(struct ast_channel *chan, const char *cmd,
AST_STANDARD_APP_ARGS(args, parse);
- if (ast_strlen_zero(args.min) || sscanf(args.min, "%d", &min_int) != 1)
+ if (ast_strlen_zero(args.min) || sscanf(args.min, "%30d", &min_int) != 1)
min_int = 0;
- if (ast_strlen_zero(args.max) || sscanf(args.max, "%d", &max_int) != 1)
+ if (ast_strlen_zero(args.max) || sscanf(args.max, "%30d", &max_int) != 1)
max_int = RAND_MAX;
if (max_int < min_int) {
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index de754be68..5f4ebc833 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -485,7 +485,7 @@ static int acf_sprintf(struct ast_channel *chan, const char *cmd, char *data, ch
/* Convert the argument into the required type */
if (arg.var[argcount]) {
- if (sscanf(arg.var[argcount++], "%d", &tmpi) != 1) {
+ if (sscanf(arg.var[argcount++], "%30d", &tmpi) != 1) {
ast_log(LOG_ERROR, "Argument '%s' is not an integer number for format '%s'\n", arg.var[argcount - 1], formatbuf);
goto sprintf_fail;
}
@@ -508,7 +508,7 @@ static int acf_sprintf(struct ast_channel *chan, const char *cmd, char *data, ch
/* Convert the argument into the required type */
if (arg.var[argcount]) {
- if (sscanf(arg.var[argcount++], "%lf", &tmpd) != 1) {
+ if (sscanf(arg.var[argcount++], "%30lf", &tmpd) != 1) {
ast_log(LOG_ERROR, "Argument '%s' is not a floating point number for format '%s'\n", arg.var[argcount - 1], formatbuf);
goto sprintf_fail;
}
diff --git a/main/acl.c b/main/acl.c
index 54747de5f..731de5cc6 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -291,7 +291,7 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha
nm++;
if (!strchr(nm, '.')) {
- if ((sscanf(nm, "%d", &x) == 1) && (x >= 0) && (x <= 32))
+ if ((sscanf(nm, "%30d", &x) == 1) && (x >= 0) && (x <= 32))
ha->netmask.s_addr = htonl(0xFFFFFFFF << (32 - x));
else {
ast_log(LOG_WARNING, "Invalid CIDR in %s\n", stuff);
@@ -413,14 +413,14 @@ static const struct dscp_codepoint dscp_pool1[] = {
int ast_str2cos(const char *value, unsigned int *cos)
{
int fval;
-
- if (sscanf(value, "%d", &fval) == 1) {
+
+ if (sscanf(value, "%30d", &fval) == 1) {
if (fval < 8) {
- *cos = fval;
+ *cos = fval;
return 0;
}
}
-
+
return -1;
}
@@ -429,7 +429,7 @@ int ast_str2tos(const char *value, unsigned int *tos)
int fval;
unsigned int x;
- if (sscanf(value, "%i", &fval) == 1) {
+ if (sscanf(value, "%30i", &fval) == 1) {
*tos = fval & 0xFF;
return 0;
}
diff --git a/main/asterisk.c b/main/asterisk.c
index e8bac98c3..2abee13c6 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1165,7 +1165,7 @@ static int ast_makesocket(void)
if (!ast_strlen_zero(ast_config_AST_CTL_PERMISSIONS)) {
int p1;
mode_t p;
- sscanf(ast_config_AST_CTL_PERMISSIONS, "%o", &p1);
+ sscanf(ast_config_AST_CTL_PERMISSIONS, "%30o", &p1);
p = p1;
if ((chmod(ast_config_AST_SOCKET, p)) < 0)
ast_log(LOG_WARNING, "Unable to change file permissions of %s: %s\n", ast_config_AST_SOCKET, strerror(errno));
@@ -2025,10 +2025,10 @@ static char *cli_prompt(EditLine *el)
switch (*t) {
case 'C': /* color */
t++;
- if (sscanf(t, "%d;%d%n", &fgcolor, &bgcolor, &i) == 2) {
+ if (sscanf(t, "%30d;%30d%n", &fgcolor, &bgcolor, &i) == 2) {
strncat(p, term_color_code(term_code, fgcolor, bgcolor, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1);
t += i - 1;
- } else if (sscanf(t, "%d%n", &fgcolor, &i) == 1) {
+ } else if (sscanf(t, "%30d%n", &fgcolor, &i) == 1) {
strncat(p, term_color_code(term_code, fgcolor, 0, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1);
t += i - 1;
}
@@ -2065,13 +2065,13 @@ static char *cli_prompt(EditLine *el)
float avg1, avg2, avg3;
int actproc, totproc, npid, which;
- if (fscanf(LOADAVG, "%f %f %f %d/%d %d",
+ if (fscanf(LOADAVG, "%30f %30f %30f %30d/%30d %30d",
&avg1, &avg2, &avg3, &actproc, &totproc, &npid) != 6) {
ast_log(LOG_WARNING, "parsing /proc/loadavg failed\n");
fclose(LOADAVG);
break;
}
- if (sscanf(t, "%d", &which) == 1) {
+ if (sscanf(t, "%1d", &which) == 1) {
switch (which) {
case 1:
snprintf(p, sizeof(prompt) - strlen(prompt), "%.2f", avg1);
@@ -2716,7 +2716,7 @@ static void ast_readconfig(void)
/* debug level (-d at startup) */
} else if (!strcasecmp(v->name, "debug")) {
option_debug = 0;
- if (sscanf(v->value, "%d", &option_debug) != 1) {
+ if (sscanf(v->value, "%30d", &option_debug) != 1) {
option_debug = ast_true(v->value);
}
#if HAVE_WORKING_FORK
@@ -2764,7 +2764,7 @@ static void ast_readconfig(void)
} else if (!strcasecmp(v->name, "internal_timing")) {
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INTERNAL_TIMING);
} else if (!strcasecmp(v->name, "maxcalls")) {
- if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
+ if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
option_maxcalls = 0;
}
} else if (!strcasecmp(v->name, "maxload")) {
@@ -2773,7 +2773,7 @@ static void ast_readconfig(void)
if (getloadavg(test, 1) == -1) {
ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n");
option_maxload = 0.0;
- } else if ((sscanf(v->value, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) {
+ } else if ((sscanf(v->value, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) {
option_maxload = 0.0;
}
/* Set the maximum amount of open files */
@@ -2815,7 +2815,7 @@ static void ast_readconfig(void)
} else if (!strcasecmp(v->name, "minmemfree")) {
/* specify the minimum amount of free memory to retain. Asterisk should stop accepting new calls
* if the amount of free memory falls below this watermark */
- if ((sscanf(v->value, "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
+ if ((sscanf(v->value, "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
option_minmemfree = 0;
}
#endif
@@ -2823,7 +2823,7 @@ static void ast_readconfig(void)
}
for (v = ast_variable_browse(cfg, "compat"); v; v = v->next) {
float version;
- if (sscanf(v->value, "%f", &version) != 1) {
+ if (sscanf(v->value, "%30f", &version) != 1) {
ast_log(LOG_WARNING, "Compatibility version for option '%s' is not a number: '%s'\n", v->name, v->value);
continue;
}
@@ -2962,7 +2962,7 @@ int main(int argc, char *argv[])
switch (c) {
#if defined(HAVE_SYSINFO)
case 'e':
- if ((sscanf(&optarg[1], "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
+ if ((sscanf(&optarg[1], "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
option_minmemfree = 0;
}
break;
@@ -3002,11 +3002,11 @@ int main(int argc, char *argv[])
ast_set_flag(&ast_options, AST_OPT_FLAG_MUTE);
break;
case 'M':
- if ((sscanf(optarg, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0))
+ if ((sscanf(optarg, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0))
option_maxcalls = 0;
break;
case 'L':
- if ((sscanf(optarg, "%lf", &option_maxload) != 1) || (option_maxload < 0.0))
+ if ((sscanf(optarg, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0))
option_maxload = 0.0;
break;
case 'q':
diff --git a/main/cdr.c b/main/cdr.c
index 61e58200a..b4c609004 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1407,7 +1407,7 @@ static int do_reload(int reload)
batchsafeshutdown = ast_true(batchsafeshutdown_value);
}
if ((size_value = ast_variable_retrieve(config, "general", "size"))) {
- if (sscanf(size_value, "%d", &cfg_size) < 1)
+ if (sscanf(size_value, "%30d", &cfg_size) < 1)
ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", size_value);
else if (cfg_size < 0)
ast_log(LOG_WARNING, "Invalid maximum batch size '%d' specified, using default\n", cfg_size);
@@ -1415,7 +1415,7 @@ static int do_reload(int reload)
batchsize = cfg_size;
}
if ((time_value = ast_variable_retrieve(config, "general", "time"))) {
- if (sscanf(time_value, "%d", &cfg_time) < 1)
+ if (sscanf(time_value, "%30d", &cfg_time) < 1)
ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", time_value);
else if (cfg_time < 0)
ast_log(LOG_WARNING, "Invalid maximum batch time '%d' specified, using default\n", cfg_time);
diff --git a/main/channel.c b/main/channel.c
index 127f97a0c..e47a1a811 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -5072,9 +5072,9 @@ ast_group_t ast_get_group(const char *s)
c = ast_strdupa(s);
while ((piece = strsep(&c, ","))) {
- if (sscanf(piece, "%d-%d", &start, &finish) == 2) {
+ if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) {
/* Range */
- } else if (sscanf(piece, "%d", &start)) {
+ } else if (sscanf(piece, "%30d", &start)) {
/* Just one */
finish = start;
} else {
diff --git a/main/cli.c b/main/cli.c
index c3cc54d82..e1dc5d019 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -296,7 +296,7 @@ static char *handle_verbose(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
atleast = 1;
if (argc != e->args + atleast && argc != e->args + atleast + 1)
return CLI_SHOWUSAGE;
- if (sscanf(argv[e->args + atleast - 1], "%d", &newlevel) != 1)
+ if (sscanf(argv[e->args + atleast - 1], "%30d", &newlevel) != 1)
return CLI_SHOWUSAGE;
if (argc == e->args + atleast + 1) {
unsigned int debug = (*what == 'C');
diff --git a/main/config.c b/main/config.c
index ddc5baa01..36b567881 100644
--- a/main/config.c
+++ b/main/config.c
@@ -361,7 +361,7 @@ void ast_variable_insert(struct ast_category *category, struct ast_variable *var
int lineno;
int insertline;
- if (!variable || sscanf(line, "%d", &insertline) != 1)
+ if (!variable || sscanf(line, "%30d", &insertline) != 1)
return;
if (!insertline) {
variable->next = category->root;
diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index 2c1d8f943..6f16ae667 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -392,7 +392,7 @@ static int do_reload(int loading)
enabled = ast_true(enabled_value);
}
if ((interval_value = ast_variable_retrieve(config, "general", "refreshinterval"))) {
- if (sscanf(interval_value, "%d", &interval) < 1)
+ if (sscanf(interval_value, "%30d", &interval) < 1)
ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", interval_value);
else if (interval < 0)
ast_log(LOG_WARNING, "Invalid refresh interval '%d' specified, using default\n", interval);
diff --git a/main/features.c b/main/features.c
index 0f238a528..9892097f7 100644
--- a/main/features.c
+++ b/main/features.c
@@ -438,7 +438,7 @@ static struct parkeduser *park_space_reserve(struct ast_channel *chan)
* limitation here. If extout was not numeric, we could permit
* arbitrary non-numeric extensions.
*/
- if (sscanf(parkingexten, "%d", &parking_space) != 1 || parking_space < 0) {
+ if (sscanf(parkingexten, "%30d", &parking_space) != 1 || parking_space < 0) {
AST_LIST_UNLOCK(&parkinglot);
ast_free(pu);
ast_log(LOG_WARNING, "PARKINGEXTEN does not indicate a valid parking slot: '%s'.\n", parkingexten);
@@ -3135,13 +3135,13 @@ static int load_config(void)
} else if (!strcasecmp(var->name, "context")) {
ast_copy_string(parking_con, var->value, sizeof(parking_con));
} else if (!strcasecmp(var->name, "parkingtime")) {
- if ((sscanf(var->value, "%d", &parkingtime) != 1) || (parkingtime < 1)) {
+ if ((sscanf(var->value, "%30d", &parkingtime) != 1) || (parkingtime < 1)) {
ast_log(LOG_WARNING, "%s is not a valid parkingtime\n", var->value);
parkingtime = DEFAULT_PARK_TIME;
} else
parkingtime = parkingtime * 1000;
} else if (!strcasecmp(var->name, "parkpos")) {
- if (sscanf(var->value, "%d-%d", &start, &end) != 2) {
+ if (sscanf(var->value, "%30d-%30d", &start, &end) != 2) {
ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of features.conf\n", var->lineno);
} else {
parking_start = start;
@@ -3182,24 +3182,24 @@ static int load_config(void)
} else if (!strcasecmp(var->name, "adsipark")) {
adsipark = ast_true(var->value);
} else if (!strcasecmp(var->name, "transferdigittimeout")) {
- if ((sscanf(var->value, "%d", &transferdigittimeout) != 1) || (transferdigittimeout < 1)) {
+ if ((sscanf(var->value, "%30d", &transferdigittimeout) != 1) || (transferdigittimeout < 1)) {
ast_log(LOG_WARNING, "%s is not a valid transferdigittimeout\n", var->value);
transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
} else
transferdigittimeout = transferdigittimeout * 1000;
} else if (!strcasecmp(var->name, "featuredigittimeout")) {
- if ((sscanf(var->value, "%d", &featuredigittimeout) != 1) || (featuredigittimeout < 1)) {
+ if ((sscanf(var->value, "%30d", &featuredigittimeout) != 1) || (featuredigittimeout < 1)) {
ast_log(LOG_WARNING, "%s is not a valid featuredigittimeout\n", var->value);
featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
}
} else if (!strcasecmp(var->name, "atxfernoanswertimeout")) {
- if ((sscanf(var->value, "%d", &atxfernoanswertimeout) != 1) || (atxfernoanswertimeout < 1)) {
+ if ((sscanf(var->value, "%30d", &atxfernoanswertimeout) != 1) || (atxfernoanswertimeout < 1)) {
ast_log(LOG_WARNING, "%s is not a valid atxfernoanswertimeout\n", var->value);
atxfernoanswertimeout = DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER;
} else
atxfernoanswertimeout = atxfernoanswertimeout * 1000;
} else if (!strcasecmp(var->name, "atxferloopdelay")) {
- if ((sscanf(var->value, "%u", &atxferloopdelay) != 1)) {
+ if ((sscanf(var->value, "%30u", &atxferloopdelay) != 1)) {
ast_log(LOG_WARNING, "%s is not a valid atxferloopdelay\n", var->value);
atxferloopdelay = DEFAULT_ATXFER_LOOP_DELAY;
} else
@@ -3207,7 +3207,7 @@ static int load_config(void)
} else if (!strcasecmp(var->name, "atxferdropcall")) {
atxferdropcall = ast_true(var->value);
} else if (!strcasecmp(var->name, "atxfercallbackretries")) {
- if ((sscanf(var->value, "%u", &atxferloopdelay) != 1)) {
+ if ((sscanf(var->value, "%30u", &atxferloopdelay) != 1)) {
ast_log(LOG_WARNING, "%s is not a valid atxfercallbackretries\n", var->value);
atxfercallbackretries = DEFAULT_ATXFER_CALLBACK_RETRIES;
}
@@ -3778,7 +3778,7 @@ static int manager_park(struct mansession *s, const struct message *m)
}
if (!ast_strlen_zero(timeout)) {
- sscanf(timeout, "%d", &to);
+ sscanf(timeout, "%30d", &to);
}
res = ast_masq_park_call(ch1, ch2, to, &parkExt);
diff --git a/main/frame.c b/main/frame.c
index f5eaa5534..ebfae365c 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -712,7 +712,7 @@ static char *show_codec_n(struct ast_cli_entry *e, int cmd, struct ast_cli_args
if (a->argc != 4)
return CLI_SHOWUSAGE;
- if (sscanf(a->argv[3],"%d",&codec) != 1)
+ if (sscanf(a->argv[3], "%30d", &codec) != 1)
return CLI_SHOWUSAGE;
for (i = 0; i < 32; i++)
diff --git a/main/http.c b/main/http.c
index 94a82bfcb..fd219f9e3 100644
--- a/main/http.c
+++ b/main/http.c
@@ -150,10 +150,10 @@ static uint32_t manid_from_vars(struct ast_variable *sid) {
while (sid && strcmp(sid->name, "mansession_id"))
sid = sid->next;
-
- if (!sid || sscanf(sid->value, "%x", &mngid) != 1)
+
+ if (!sid || sscanf(sid->value, "%30x", &mngid) != 1)
return 0;
-
+
return mngid;
}
@@ -489,7 +489,7 @@ static struct ast_str *handle_post(struct ast_tcptls_session_instance *ser, char
if (strcasecmp(var->name, "mansession_id"))
continue;
- if (sscanf(var->value, "%lx", &ident) != 1) {
+ if (sscanf(var->value, "%30lx", &ident) != 1) {
*status = 400;
*title = ast_strdup("Bad Request");
return ast_http_error(400, "Bad Request", NULL, "The was an error parsing the request.");
@@ -514,7 +514,7 @@ static struct ast_str *handle_post(struct ast_tcptls_session_instance *ser, char
for (var = headers; var; var = var->next) {
if (!strcasecmp(var->name, "Content-Length")) {
- if ((sscanf(var->value, "%u", &content_len)) != 1) {
+ if ((sscanf(var->value, "%30u", &content_len)) != 1) {
ast_log(LOG_ERROR, "Invalid Content-Length in POST request!\n");
fclose(f);
return NULL;
diff --git a/main/indications.c b/main/indications.c
index b575dff4d..fbaddad8f 100644
--- a/main/indications.c
+++ b/main/indications.c
@@ -239,46 +239,46 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
s++;
else if (d.reppos == -1)
d.reppos = d.nitems;
- if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &time) == 3) {
+ if (sscanf(s, "%30d+%30d/%30d", &freq1, &freq2, &time) == 3) {
/* f1+f2/time format */
- } else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) {
+ } else if (sscanf(s, "%30d+%30d", &freq1, &freq2) == 2) {
/* f1+f2 format */
time = 0;
- } else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &time) == 3) {
+ } else if (sscanf(s, "%30d*%30d/%30d", &freq1, &freq2, &time) == 3) {
/* f1*f2/time format */
modulate = 1;
- } else if (sscanf(s, "%d*%d", &freq1, &freq2) == 2) {
+ } else if (sscanf(s, "%30d*%30d", &freq1, &freq2) == 2) {
/* f1*f2 format */
time = 0;
modulate = 1;
- } else if (sscanf(s, "%d/%d", &freq1, &time) == 2) {
+ } else if (sscanf(s, "%30d/%30d", &freq1, &time) == 2) {
/* f1/time format */
freq2 = 0;
- } else if (sscanf(s, "%d", &freq1) == 1) {
+ } else if (sscanf(s, "%30d", &freq1) == 1) {
/* f1 format */
freq2 = 0;
time = 0;
- } else if (sscanf(s, "M%d+M%d/%d", &freq1, &freq2, &time) == 3) {
+ } else if (sscanf(s, "M%30d+M%30d/%30d", &freq1, &freq2, &time) == 3) {
/* Mf1+Mf2/time format */
midinote = 1;
- } else if (sscanf(s, "M%d+M%d", &freq1, &freq2) == 2) {
+ } else if (sscanf(s, "M%30d+M%30d", &freq1, &freq2) == 2) {
/* Mf1+Mf2 format */
time = 0;
midinote = 1;
- } else if (sscanf(s, "M%d*M%d/%d", &freq1, &freq2, &time) == 3) {
+ } else if (sscanf(s, "M%30d*M%30d/%30d", &freq1, &freq2, &time) == 3) {
/* Mf1*Mf2/time format */
modulate = 1;
midinote = 1;
- } else if (sscanf(s, "M%d*M%d", &freq1, &freq2) == 2) {
+ } else if (sscanf(s, "M%30d*M%30d", &freq1, &freq2) == 2) {
/* Mf1*Mf2 format */
time = 0;
modulate = 1;
midinote = 1;
- } else if (sscanf(s, "M%d/%d", &freq1, &time) == 2) {
+ } else if (sscanf(s, "M%30d/%30d", &freq1, &time) == 2) {
/* Mf1/time format */
freq2 = -1;
midinote = 1;
- } else if (sscanf(s, "M%d", &freq1) == 1) {
+ } else if (sscanf(s, "M%30d", &freq1) == 1) {
/* Mf1 format */
freq2 = -1;
time = 0;
diff --git a/main/manager.c b/main/manager.c
index 7962af01c..93b20c674 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1494,7 +1494,7 @@ static int action_waitevent(struct mansession *s, const struct message *m)
idText[0] = '\0';
if (!ast_strlen_zero(timeouts)) {
- sscanf(timeouts, "%i", &timeout);
+ sscanf(timeouts, "%30i", &timeout);
if (timeout < -1)
timeout = -1;
/* XXX maybe put an upper bound, or prevent the use of 0 ? */
@@ -1937,7 +1937,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
astman_send_error(s, m, "Channel not specified");
return 0;
}
- if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
+ if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) {
if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
astman_send_error(s, m, "Invalid priority");
return 0;
@@ -2200,13 +2200,13 @@ static int action_originate(struct mansession *s, const struct message *m)
astman_send_error(s, m, "Channel not specified");
return 0;
}
- if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
+ if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) {
if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
astman_send_error(s, m, "Invalid priority");
return 0;
}
}
- if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%d", &to) != 1)) {
+ if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%30d", &to) != 1)) {
astman_send_error(s, m, "Invalid timeout");
return 0;
}
@@ -3568,7 +3568,7 @@ static struct ast_str *generic_http_callback(enum output_format format,
for (v = params; v; v = v->next) {
if (!strcasecmp(v->name, "mansession_id")) {
- sscanf(v->value, "%x", &ident);
+ sscanf(v->value, "%30x", &ident);
break;
}
}
diff --git a/main/pbx.c b/main/pbx.c
index 5e897da66..9a3b58906 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -2301,7 +2301,7 @@ static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
parens--;
} else if (*var == ':' && parens == 0) {
*var++ = '\0';
- sscanf(var, "%d:%d", offset, length);
+ sscanf(var, "%30d:%30d", offset, length);
return 1; /* offset:length valid */
}
}
@@ -5936,7 +5936,7 @@ static int lookup_name(const char *s, char *const names[], int max)
if (!strcasecmp(s, names[i]))
return i+1;
}
- } else if (sscanf(s, "%d", &i) == 1 && i >= 1 && i <= max) {
+ } else if (sscanf(s, "%2d", &i) == 1 && i >= 1 && i <= max) {
return i;
}
return 0; /* error return */
@@ -6023,11 +6023,11 @@ static void get_timerange(struct ast_timing *i, char *times)
ast_log(LOG_WARNING, "Invalid time range. Assuming no restrictions based on time.\n");
return;
}
- if (sscanf(times, "%d:%d", &s1, &s2) != 2) {
+ if (sscanf(times, "%2d:%2d", &s1, &s2) != 2) {
ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", times);
return;
}
- if (sscanf(e, "%d:%d", &e1, &e2) != 2) {
+ if (sscanf(e, "%2d:%2d", &e1, &e2) != 2) {
ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", e);
return;
}
@@ -7546,7 +7546,7 @@ static void wait_for_hangup(struct ast_channel *chan, void *data)
double waitsec;
int waittime;
- if (ast_strlen_zero(data) || (sscanf(data, "%lg", &waitsec) != 1) || (waitsec < 0))
+ if (ast_strlen_zero(data) || (sscanf(data, "%30lg", &waitsec) != 1) || (waitsec < 0))
waitsec = -1;
if (waitsec > -1) {
waittime = waitsec * 1000.0;
@@ -8644,7 +8644,7 @@ static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string,
mode = -1;
pri++;
}
- if (sscanf(pri, "%d", &ipri) != 1) {
+ if (sscanf(pri, "%30d", &ipri) != 1) {
if ((ipri = ast_findlabel_extension(chan, context ? context : chan->context, exten ? exten : chan->exten,
pri, chan->cid.cid_num)) < 1) {
ast_log(LOG_WARNING, "Priority '%s' must be a number > 0, or valid label\n", pri);
diff --git a/main/utils.c b/main/utils.c
index 4403e5310..c37458588 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -1574,7 +1574,7 @@ int ast_get_timeval(const char *src, struct timeval *dst, struct timeval _defaul
return -1;
/* only integer at the moment, but one day we could accept more formats */
- if (sscanf(src, "%Lf%n", &dtv, &scanned) > 0) {
+ if (sscanf(src, "%30Lf%n", &dtv, &scanned) > 0) {
dst->tv_sec = dtv;
dst->tv_usec = (dtv - dst->tv_sec) * 1000000.0;
if (consumed)
@@ -1601,7 +1601,7 @@ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
return -1;
/* only integer at the moment, but one day we could accept more formats */
- if (sscanf(src, "%ld%n", &t, &scanned) == 1) {
+ if (sscanf(src, "%30ld%n", &t, &scanned) == 1) {
*dst = t;
if (consumed)
*consumed = scanned;
diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c
index 0195e3adc..cdb2dc7a2 100644
--- a/pbx/dundi-parser.c
+++ b/pbx/dundi-parser.c
@@ -85,9 +85,9 @@ int dundi_str_to_eid(dundi_eid *eid, const char *s)
{
unsigned int eid_int[6];
int x;
- if (sscanf(s, "%x:%x:%x:%x:%x:%x", &eid_int[0], &eid_int[1], &eid_int[2],
+ if (sscanf(s, "%2x:%2x:%2x:%2x:%2x:%2x", &eid_int[0], &eid_int[1], &eid_int[2],
&eid_int[3], &eid_int[4], &eid_int[5]) != 6)
- return -1;
+ return -1;
for (x=0;x<6;x++)
eid->eid[x] = eid_int[x];
return 0;
@@ -99,7 +99,7 @@ int dundi_str_short_to_eid(dundi_eid *eid, const char *s)
int x;
if (sscanf(s, "%2x%2x%2x%2x%2x%2x", &eid_int[0], &eid_int[1], &eid_int[2],
&eid_int[3], &eid_int[4], &eid_int[5]) != 6)
- return -1;
+ return -1;
for (x = 0; x < 6; x++)
eid->eid[x] = eid_int[x];
return 0;
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index f2cf7448b..39f723e54 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1010,7 +1010,7 @@ static char *handle_cli_dialplan_add_extension(struct ast_cli_entry *e, int cmd,
if (!strcmp(prior, "hint")) {
iprior = PRIORITY_HINT;
} else {
- if (sscanf(prior, "%d", &iprior) != 1) {
+ if (sscanf(prior, "%30d", &iprior) != 1) {
ast_cli(a->fd, "'%s' is not a valid priority\n", prior);
prior = NULL;
}
@@ -1490,7 +1490,7 @@ static int pbx_load_config(const char *config_file)
ipri = lastpri;
else
ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n");
- } else if (sscanf(pri, "%d", &ipri) != 1 &&
+ } else if (sscanf(pri, "%30d", &ipri) != 1 &&
(ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) {
ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno);
ipri = 0;
@@ -1617,9 +1617,9 @@ static void pbx_load_users(void)
c = dahdicopy;
chan = strsep(&c, ",");
while (chan) {
- if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
+ if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) {
/* Range */
- } else if (sscanf(chan, "%d", &start)) {
+ } else if (sscanf(chan, "%30d", &start)) {
/* Just one */
finish = start;
} else {
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 4d94aaca6..71ff88541 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -519,7 +519,7 @@ static int get_mapping_weight(struct dundi_mapping *map)
buf[0] = 0;
if (map->weightstr) {
pbx_substitute_variables_helper(NULL, map->weightstr, buf, sizeof(buf) - 1);
- if (sscanf(buf, "%d", &map->_weight) != 1)
+ if (sscanf(buf, "%30d", &map->_weight) != 1)
map->_weight = MAX_WEIGHT;
}
@@ -1132,7 +1132,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
if (expiration > 0) {
ast_debug(1, "Found cache expiring in %d seconds!\n", expiration);
ptr += length + 1;
- while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
+ while((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
ptr += length;
term = strchr(ptr, '|');
if (term) {
@@ -4132,7 +4132,7 @@ static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *da
goto finish;
}
- if (sscanf(args.resultnum, "%u", &num) != 1) {
+ if (sscanf(args.resultnum, "%30u", &num) != 1) {
ast_log(LOG_ERROR, "Invalid value '%s' for resultnum to DUNDIRESULT!\n",
args.resultnum);
goto finish;
@@ -4296,7 +4296,7 @@ static void build_mapping(const char *name, const char *value)
} else if (x >= 4) {
ast_copy_string(map->dcontext, name, sizeof(map->dcontext));
ast_copy_string(map->lcontext, fields[0], sizeof(map->lcontext));
- if ((sscanf(fields[1], "%d", &map->_weight) == 1) && (map->_weight >= 0) && (map->_weight <= MAX_WEIGHT)) {
+ if ((sscanf(fields[1], "%30d", &map->_weight) == 1) && (map->_weight >= 0) && (map->_weight <= MAX_WEIGHT)) {
ast_copy_string(map->dest, fields[3], sizeof(map->dest));
if ((map->tech = str2tech(fields[2])))
map->dead = 0;
@@ -4398,7 +4398,7 @@ static void populate_addr(struct dundi_peer *peer, dundi_eid *eid)
if (c) {
*c = '\0';
c++;
- if (sscanf(c, "%d:%d", &port, &expire) == 2) {
+ if (sscanf(c, "%5d:%30d", &port, &expire) == 2) {
/* Got it! */
inet_aton(data, &peer->addr.sin_addr);
peer->addr.sin_family = AF_INET;
@@ -4495,7 +4495,7 @@ static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of dundi.conf\n",
dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid), v->lineno);
peer->maxms = 0;
@@ -4732,14 +4732,14 @@ static int set_config(char *config_file, struct sockaddr_in* sin, int reload)
} else if (!strcasecmp(v->name, "authdebug")) {
authdebug = ast_true(v->value);
} else if (!strcasecmp(v->name, "ttl")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) {
+ if ((sscanf(v->value, "%30d", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) {
dundi_ttl = x;
} else {
ast_log(LOG_WARNING, "'%s' is not a valid TTL at line %d, must be number from 1 to %d\n",
v->value, v->lineno, DUNDI_DEFAULT_TTL);
}
} else if (!strcasecmp(v->name, "autokill")) {
- if (sscanf(v->value, "%d", &x) == 1) {
+ if (sscanf(v->value, "%30d", &x) == 1) {
if (x >= 0)
global_autokilltimeout = x;
else
@@ -4774,7 +4774,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin, int reload)
} else if (!strcasecmp(v->name, "storehistory")) {
global_storehistory = ast_true(v->value);
} else if (!strcasecmp(v->name, "cachetime")) {
- if ((sscanf(v->value, "%d", &x) == 1)) {
+ if ((sscanf(v->value, "%30d", &x) == 1)) {
dundi_cache_time = x;
} else {
ast_log(LOG_WARNING, "'%s' is not a valid cache time at line %d. Using default value '%d'.\n",
diff --git a/pbx/pbx_loopback.c b/pbx/pbx_loopback.c
index e9001deef..f51ec8204 100644
--- a/pbx/pbx_loopback.c
+++ b/pbx/pbx_loopback.c
@@ -120,7 +120,7 @@ static void loopback_parse(char **newexten, char **newcontext, int *priority, ch
if (!ast_strlen_zero(con))
*newcontext = con;
if (!ast_strlen_zero(pri))
- sscanf(pri, "%d", priority);
+ sscanf(pri, "%30d", priority);
}
static int loopback_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 3f85c4c7b..6307a2098 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -182,7 +182,7 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
} else if (!strcasecmp(buf, "data")) {
ast_copy_string(o->data, c, sizeof(o->data));
} else if (!strcasecmp(buf, "maxretries")) {
- if (sscanf(c, "%d", &o->maxretries) != 1) {
+ if (sscanf(c, "%30d", &o->maxretries) != 1) {
ast_log(LOG_WARNING, "Invalid max retries at line %d of %s\n", lineno, fn);
o->maxretries = 0;
}
@@ -193,24 +193,24 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
} else if (!strcasecmp(buf, "extension")) {
ast_copy_string(o->exten, c, sizeof(o->exten));
} else if (!strcasecmp(buf, "priority")) {
- if ((sscanf(c, "%d", &o->priority) != 1) || (o->priority < 1)) {
+ if ((sscanf(c, "%30d", &o->priority) != 1) || (o->priority < 1)) {
ast_log(LOG_WARNING, "Invalid priority at line %d of %s\n", lineno, fn);
o->priority = 1;
}
} else if (!strcasecmp(buf, "retrytime")) {
- if ((sscanf(c, "%d", &o->retrytime) != 1) || (o->retrytime < 1)) {
+ if ((sscanf(c, "%30d", &o->retrytime) != 1) || (o->retrytime < 1)) {
ast_log(LOG_WARNING, "Invalid retrytime at line %d of %s\n", lineno, fn);
o->retrytime = 300;
}
} else if (!strcasecmp(buf, "waittime")) {
- if ((sscanf(c, "%d", &o->waittime) != 1) || (o->waittime < 1)) {
+ if ((sscanf(c, "%30d", &o->waittime) != 1) || (o->waittime < 1)) {
ast_log(LOG_WARNING, "Invalid waittime at line %d of %s\n", lineno, fn);
o->waittime = 45;
}
} else if (!strcasecmp(buf, "retry")) {
o->retries++;
} else if (!strcasecmp(buf, "startretry")) {
- if (sscanf(c, "%ld", &o->callingpid) != 1) {
+ if (sscanf(c, "%30ld", &o->callingpid) != 1) {
ast_log(LOG_WARNING, "Unable to retrieve calling PID!\n");
o->callingpid = 0;
}
diff --git a/res/ael/pval.c b/res/ael/pval.c
index 606866d3f..a5cae099e 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -859,12 +859,12 @@ static void check_timerange(pval *p)
p->filename, p->startline, p->endline, p->u1.str);
warns++;
}
- if (sscanf(times, "%d:%d", &s1, &s2) != 2) {
+ if (sscanf(times, "%2d:%2d", &s1, &s2) != 2) {
ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The start time (%s) isn't quite right!\n",
p->filename, p->startline, p->endline, times);
warns++;
}
- if (sscanf(e, "%d:%d", &e1, &e2) != 2) {
+ if (sscanf(e, "%2d:%2d", &e1, &e2) != 2) {
ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The end time (%s) isn't quite right!\n",
p->filename, p->startline, p->endline, times);
warns++;
@@ -956,7 +956,7 @@ static void check_day(pval *DAY)
c++;
}
/* Find the start */
- if (sscanf(day, "%d", &s) != 1) {
+ if (sscanf(day, "%2d", &s) != 1) {
ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The start day of month (%s) must be a number!\n",
DAY->filename, DAY->startline, DAY->endline, day);
warns++;
@@ -968,7 +968,7 @@ static void check_day(pval *DAY)
}
s--;
if (c) {
- if (sscanf(c, "%d", &e) != 1) {
+ if (sscanf(c, "%2d", &e) != 1) {
ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The end day of month (%s) must be a number!\n",
DAY->filename, DAY->startline, DAY->endline, c);
warns++;
diff --git a/res/res_agi.c b/res/res_agi.c
index 6914d0e81..1be49888f 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -814,7 +814,7 @@ static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, cha
if (argc != 4)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[3], "%d", &to) != 1)
+ if (sscanf(argv[3], "%30d", &to) != 1)
return RESULT_SHOWUSAGE;
res = ast_waitfordigit_full(chan, to, agi->audio, agi->ctrl);
ast_agi_send(agi->fd, chan, "200 result=%d\n", res);
@@ -927,7 +927,7 @@ static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc
else
stop = NULL;
- if ((argc > 5) && (sscanf(argv[5], "%d", &skipms) != 1))
+ if ((argc > 5) && (sscanf(argv[5], "%30d", &skipms) != 1))
return RESULT_SHOWUSAGE;
if (argc > 6 && !ast_strlen_zero(argv[6]))
@@ -965,7 +965,7 @@ static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, char
if (argv[3])
edigits = argv[3];
- if ((argc > 4) && (sscanf(argv[4], "%ld", &sample_offset) != 1))
+ if ((argc > 4) && (sscanf(argv[4], "%30ld", &sample_offset) != 1))
return RESULT_SHOWUSAGE;
if (!(fs = ast_openstream(chan, argv[2], chan->language))) {
@@ -1077,7 +1077,7 @@ static int handle_saynumber(struct ast_channel *chan, AGI *agi, int argc, char *
if (argc < 4 || argc > 5)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2], "%d", &num) != 1)
+ if (sscanf(argv[2], "%30d", &num) != 1)
return RESULT_SHOWUSAGE;
res = ast_say_number_full(chan, num, argv[3], chan->language, argc > 4 ? argv[4] : NULL, agi->audio, agi->ctrl);
if (res == 1)
@@ -1092,7 +1092,7 @@ static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, char *
if (argc != 4)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2], "%d", &num) != 1)
+ if (sscanf(argv[2], "%30d", &num) != 1)
return RESULT_SHOWUSAGE;
res = ast_say_digit_str_full(chan, argv[2], argv[3], chan->language, agi->audio, agi->ctrl);
@@ -1122,7 +1122,7 @@ static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, char *ar
if (argc != 4)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2], "%d", &num) != 1)
+ if (sscanf(argv[2], "%30d", &num) != 1)
return RESULT_SHOWUSAGE;
res = ast_say_date(chan, num, argv[3], chan->language);
if (res == 1)
@@ -1137,7 +1137,7 @@ static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *ar
if (argc != 4)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2], "%d", &num) != 1)
+ if (sscanf(argv[2], "%30d", &num) != 1)
return RESULT_SHOWUSAGE;
res = ast_say_time(chan, num, argv[3], chan->language);
if (res == 1)
@@ -1247,7 +1247,7 @@ static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, char
if (argc != 3)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2], "%d", &pri) != 1) {
+ if (sscanf(argv[2], "%30d", &pri) != 1) {
if ((pri = ast_findlabel_extension(chan, chan->context, chan->exten, argv[2], chan->cid.cid_num)) < 1)
return RESULT_SHOWUSAGE;
}
@@ -1279,7 +1279,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
if (argc < 6)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[5], "%d", &ms) != 1)
+ if (sscanf(argv[5], "%30d", &ms) != 1)
return RESULT_SHOWUSAGE;
if (argc > 6)
@@ -1320,7 +1320,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
/* backward compatibility, if no offset given, arg[6] would have been
* caught below and taken to be a beep, else if it is a digit then it is a
* offset */
- if ((argc >6) && (sscanf(argv[6], "%ld", &sample_offset) != 1) && (!strchr(argv[6], '=')))
+ if ((argc >6) && (sscanf(argv[6], "%30ld", &sample_offset) != 1) && (!strchr(argv[6], '=')))
res = ast_streamfile(chan, "beep", chan->language);
if ((argc > 7) && (!strchr(argv[7], '=')))
@@ -1440,7 +1440,7 @@ static int handle_autohangup(struct ast_channel *chan, AGI *agi, int argc, char
if (argc != 3)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2], "%d", &timeout) != 1)
+ if (sscanf(argv[2], "%30d", &timeout) != 1)
return RESULT_SHOWUSAGE;
if (timeout < 0)
timeout = 0;
@@ -1624,7 +1624,7 @@ static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, char **a
return RESULT_SHOWUSAGE;
if (argv[2])
- sscanf(argv[2], "%d", &level);
+ sscanf(argv[2], "%30d", &level);
ast_verb(level, "%s: %s\n", chan->data, argv[1]);
diff --git a/res/res_config_curl.c b/res/res_config_curl.c
index f36a5f6a9..ed561d62b 100644
--- a/res/res_config_curl.c
+++ b/res/res_config_curl.c
@@ -264,7 +264,7 @@ static int update_curl(const char *url, const char *unused, const char *keyfield
stringp = buffer;
while (*stringp <= ' ')
stringp++;
- sscanf(stringp, "%d", &rowcount);
+ sscanf(stringp, "%30d", &rowcount);
ast_free(buffer);
ast_free(query);
@@ -327,7 +327,7 @@ static int store_curl(const char *url, const char *unused, va_list ap)
stringp = buffer;
while (*stringp <= ' ')
stringp++;
- sscanf(stringp, "%d", &rowcount);
+ sscanf(stringp, "%30d", &rowcount);
ast_free(buffer);
ast_free(query);
@@ -395,7 +395,7 @@ static int destroy_curl(const char *url, const char *unused, const char *keyfiel
stringp = buffer;
while (*stringp <= ' ')
stringp++;
- sscanf(stringp, "%d", &rowcount);
+ sscanf(stringp, "%30d", &rowcount);
ast_free(buffer);
ast_free(query);
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 1e178cdcd..eadf8b596 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1416,7 +1416,7 @@ int parse_config(void)
if ((s = ast_variable_retrieve(config, "_general", "url"))) {
ast_copy_string(url, s, sizeof(url));
} else if ((host = ast_variable_retrieve(config, "_general", "host"))) {
- if (!(s = ast_variable_retrieve(config, "_general", "port")) || sscanf(s, "%d", &port) != 1) {
+ if (!(s = ast_variable_retrieve(config, "_general", "port")) || sscanf(s, "%5d", &port) != 1 || port > 65535) {
ast_log(LOG_NOTICE, "No directory port found, using 389 as default.\n");
port = 389;
}
@@ -1437,7 +1437,7 @@ int parse_config(void)
if (!(s = ast_variable_retrieve(config, "_general", "version")) && !(s = ast_variable_retrieve(config, "_general", "protocol"))) {
ast_log(LOG_NOTICE, "No explicit LDAP version found, using 3 as default.\n");
version = 3;
- } else if (sscanf(s, "%d", &version) != 1 || version < 1 || version > 6) {
+ } else if (sscanf(s, "%30d", &version) != 1 || version < 1 || version > 6) {
ast_log(LOG_WARNING, "Invalid LDAP version '%s', using 3 as default.\n", s);
version = 3;
}
diff --git a/res/res_limit.c b/res/res_limit.c
index b1cf025b0..94a6e8719 100644
--- a/res/res_limit.c
+++ b/res/res_limit.c
@@ -178,7 +178,7 @@ static char *handle_cli_ulimit(struct ast_cli_entry *e, int cmd, struct ast_cli_
return CLI_FAILURE;
}
- sscanf(a->argv[2], "%d", &x);
+ sscanf(a->argv[2], "%30d", &x);
rlimit.rlim_max = rlimit.rlim_cur = x;
setrlimit(resource, &rlimit);
return CLI_SUCCESS;
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index a2f0da3c7..e0d7c190a 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -649,7 +649,7 @@ static int play_moh_exec(struct ast_channel *chan, void *data)
AST_STANDARD_APP_ARGS(args, parse);
if (!ast_strlen_zero(args.duration)) {
- if (sscanf(args.duration, "%d", &timeout) == 1) {
+ if (sscanf(args.duration, "%30d", &timeout) == 1) {
timeout *= 1000;
} else {
ast_log(LOG_WARNING, "Invalid MusicOnHold duration '%s'. Will wait indefinitely.\n", args.duration);
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 070d0eb6a..b0c87ea7e 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -267,7 +267,7 @@ static int load_odbc_config(void)
if (ast_false(v->value))
pooling = 1;
} else if (!strcasecmp(v->name, "limit")) {
- sscanf(v->value, "%d", &limit);
+ sscanf(v->value, "%30d", &limit);
if (ast_true(v->value) && !limit) {
ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat);
limit = 1023;
@@ -277,7 +277,7 @@ static int load_odbc_config(void)
break;
}
} else if (!strcasecmp(v->name, "idlecheck")) {
- sscanf(v->value, "%d", &idlecheck);
+ sscanf(v->value, "%30u", &idlecheck);
} else if (!strcasecmp(v->name, "enabled")) {
enabled = ast_true(v->value);
} else if (!strcasecmp(v->name, "pre-connect")) {
@@ -659,7 +659,7 @@ static int reload(void)
if (ast_false(v->value))
pooling = 1;
} else if (!strcasecmp(v->name, "limit")) {
- sscanf(v->value, "%d", &limit);
+ sscanf(v->value, "%30d", &limit);
if (ast_true(v->value) && !limit) {
ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat);
limit = 1023;
@@ -669,7 +669,7 @@ static int reload(void)
break;
}
} else if (!strcasecmp(v->name, "idlecheck")) {
- sscanf(v->value, "%ud", &idlecheck);
+ sscanf(v->value, "%30u", &idlecheck);
} else if (!strcasecmp(v->name, "enabled")) {
enabled = ast_true(v->value);
} else if (!strcasecmp(v->name, "pre-connect")) {
diff --git a/res/res_smdi.c b/res/res_smdi.c
index 69a34ff59..6a151ea19 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -847,7 +847,7 @@ static int smdi_load(int reload)
baud_rate = B9600;
}
} else if (!strcasecmp(v->name, "msdstrip")) {
- if (!sscanf(v->value, "%d", &msdstrip)) {
+ if (!sscanf(v->value, "%30d", &msdstrip)) {
ast_log(LOG_NOTICE, "Invalid msdstrip value in %s (line %d), using default\n", config_file, v->lineno);
msdstrip = 0;
} else if (0 > msdstrip || msdstrip > 9) {
@@ -855,7 +855,7 @@ static int smdi_load(int reload)
msdstrip = 0;
}
} else if (!strcasecmp(v->name, "msgexpirytime")) {
- if (!sscanf(v->value, "%ld", &msg_expiry)) {
+ if (!sscanf(v->value, "%30ld", &msg_expiry)) {
ast_log(LOG_NOTICE, "Invalid msgexpirytime value in %s (line %d), using default\n", config_file, v->lineno);
msg_expiry = SMDI_MSG_EXPIRY_TIME;
}
@@ -988,7 +988,7 @@ static int smdi_load(int reload)
continue;
}
} else if (!strcasecmp(v->name, "pollinginterval")) {
- if (sscanf(v->value, "%u", &mwi_monitor.polling_interval) != 1) {
+ if (sscanf(v->value, "%30u", &mwi_monitor.polling_interval) != 1) {
ast_log(LOG_ERROR, "Invalid value for pollinginterval: %s\n", v->value);
mwi_monitor.polling_interval = DEFAULT_POLLING_INTERVAL;
}
@@ -1098,7 +1098,7 @@ static int smdi_msg_retrieve_read(struct ast_channel *chan, const char *cmd, cha
}
if (!ast_strlen_zero(args.timeout)) {
- if (sscanf(args.timeout, "%u", &timeout) != 1) {
+ if (sscanf(args.timeout, "%30u", &timeout) != 1) {
ast_log(LOG_ERROR, "'%s' is not a valid timeout\n", args.timeout);
timeout = SMDI_RETRIEVE_TIMEOUT_DEFAULT;
}
diff --git a/res/snmp/agent.c b/res/snmp/agent.c
index 92e577985..bb6a4464c 100644
--- a/res/snmp/agent.c
+++ b/res/snmp/agent.c
@@ -745,7 +745,7 @@ static u_char *ast_var_Version(struct variable *vp, oid *name, size_t *length,
return (u_char *)version;
}
case ASTVERTAG:
- sscanf(ast_get_version_num(), "%lu", &long_ret);
+ sscanf(ast_get_version_num(), "%30lu", &long_ret);
return (u_char *)&long_ret;
default:
break;
diff --git a/utils/extconf.c b/utils/extconf.c
index 1327202f6..e29695d24 100644
--- a/utils/extconf.c
+++ b/utils/extconf.c
@@ -3147,7 +3147,7 @@ static int lookup_name(const char *s, char *const names[], int max)
if (!strcasecmp(s, names[i]))
return i+1;
}
- } else if (sscanf(s, "%d", &i) == 1 && i >= 1 && i <= max) {
+ } else if (sscanf(s, "%30d", &i) == 1 && i >= 1 && i <= max) {
return i;
}
return 0; /* error return */
@@ -3234,11 +3234,11 @@ static void get_timerange(struct ast_timing *i, char *times)
ast_log(LOG_WARNING, "Invalid time range. Assuming no restrictions based on time.\n");
return;
}
- if (sscanf(times, "%d:%d", &s1, &s2) != 2) {
+ if (sscanf(times, "%2d:%2d", &s1, &s2) != 2) {
ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", times);
return;
}
- if (sscanf(e, "%d:%d", &e1, &e2) != 2) {
+ if (sscanf(e, "%2d:%2d", &e1, &e2) != 2) {
ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", e);
return;
}
@@ -5550,7 +5550,7 @@ static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
parens--;
} else if (*var == ':' && parens == 0) {
*var++ = '\0';
- sscanf(var, "%d:%d", offset, length);
+ sscanf(var, "%30d:%30d", offset, length);
return 1; /* offset:length valid */
}
}
@@ -5954,7 +5954,7 @@ static int pbx_load_config(const char *config_file)
ipri = lastpri;
else
ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n");
- } else if (sscanf(pri, "%d", &ipri) != 1 &&
+ } else if (sscanf(pri, "%30d", &ipri) != 1 &&
(ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) {
ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno);
ipri = 0;
diff --git a/utils/frame.c b/utils/frame.c
index 67fa8483e..30ab03a5b 100644
--- a/utils/frame.c
+++ b/utils/frame.c
@@ -355,7 +355,7 @@ int parsetime(char *string, int *result)
double temp;
char m, s, end;
- k = sscanf(string, "%lf%c%c%c", &temp, &m, &s, &end);
+ k = sscanf(string, "%30lf%1c%1c%1c", &temp, &m, &s, &end);
switch (k)
{
case 0: case EOF: case 4:
@@ -396,7 +396,7 @@ int parsefreq(char *string, double *result)
double temp;
char m, s, end;
- k = sscanf(string, "%lf%c%c%c", &temp, &m, &s, &end);
+ k = sscanf(string, "%30lf%1c%1c%1c", &temp, &m, &s, &end);
switch (k)
{
case 0: case EOF: case 2: case 4:
@@ -476,7 +476,7 @@ int parseintarg( int argcount, char *args[], char *string, int *result)
if ((i = findoption( argcount, args, string)) > 0)
{
switch (sscanf(args[i] + 1 + strlen( string),
- "%d%c", &temp, &c))
+ "%30d%1c", &temp, &c))
{
case 0: case EOF: case 2:
argerrornum(args[i]+1, ME_NOINT);
@@ -510,7 +510,7 @@ int parsedoublearg( int argcount, char *args[], char *string, double *result)
if ((i = findoption( argcount, args, string)) > 0)
{
- switch (sscanf(args[i] + 1 + strlen( string), "%lf%c", &temp, &end))
+ switch (sscanf(args[i] + 1 + strlen( string), "%30lf%1c", &temp, &end))
{
case 0: case EOF: case 2:
argerrornum(args[i]+1, ME_NODOUBLE);
@@ -545,7 +545,7 @@ int parsevolarg( int argcount, char *args[], char *string, double *result)
if ((i = findoption( argcount, args, string)) > 0)
{
switch (sscanf(args[i] + 1 + strlen( string),
- "%lf%c%c%c", &vol, &sbd, &sbb, &end))
+ "%30lf%1c%1c%1c", &vol, &sbd, &sbb, &end))
{
case 0: case EOF: case 4:
weird = TRUE;
@@ -593,7 +593,7 @@ int parsevolume(char *s, double *result)
char sbd, sbb, end;
*result = 1.0;
- k = sscanf(s, "%lf%c%c%c", result, &sbd, &sbb, &end);
+ k = sscanf(s, "%30lf%1c%1c%1c", result, &sbd, &sbb, &end);
switch (k)
{
case 0:
diff --git a/utils/muted.c b/utils/muted.c
index 6a7569557..14bb156e3 100644
--- a/utils/muted.c
+++ b/utils/muted.c
@@ -156,7 +156,7 @@ static int load_config(void)
} else if (!strcasecmp(buf, "smoothfade")) {
smoothfade = 1;
} else if (!strcasecmp(buf, "mutelevel")) {
- if (val && (sscanf(val, "%d", &x) == 1) && (x > -1) && (x < 101)) {
+ if (val && (sscanf(val, "%3d", &x) == 1) && (x > -1) && (x < 101)) {
mutelevel = x;
} else
fprintf(stderr, "mutelevel must be a number from 0 (most muted) to 100 (no mute) at line %d\n", lineno);
@@ -216,7 +216,7 @@ static int connect_asterisk(void)
if (ports) {
*ports = '\0';
ports++;
- if ((sscanf(ports, "%d", &port) != 1) || (port < 1) || (port > 65535)) {
+ if ((sscanf(ports, "%5d", &port) != 1) || (port < 1) || (port > 65535)) {
fprintf(stderr, "'%s' is not a valid port number in the hostname\n", ports);
return -1;
}