aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--acl.c4
-rw-r--r--apps/app_adsiprog.c6
-rw-r--r--apps/app_alarmreceiver.c2
-rw-r--r--apps/app_chanspy.c2
-rw-r--r--apps/app_cut.c10
-rw-r--r--apps/app_dial.c4
-rw-r--r--apps/app_disa.c4
-rw-r--r--apps/app_groupcount.c2
-rw-r--r--apps/app_macro.c8
-rw-r--r--apps/app_math.c4
-rw-r--r--apps/app_meetme.c12
-rw-r--r--apps/app_mixmonitor.c6
-rw-r--r--apps/app_osplookup.c6
-rw-r--r--apps/app_privacy.c8
-rw-r--r--apps/app_queue.c8
-rw-r--r--apps/app_random.c2
-rw-r--r--apps/app_readfile.c2
-rw-r--r--apps/app_record.c4
-rw-r--r--apps/app_sayunixtime.c2
-rw-r--r--apps/app_sms.c2
-rw-r--r--apps/app_talkdetect.c6
-rw-r--r--apps/app_verbose.c2
-rw-r--r--apps/app_voicemail.c24
-rw-r--r--apps/app_waitforring.c2
-rw-r--r--apps/app_waitforsilence.c4
-rw-r--r--apps/app_zapbarge.c6
-rw-r--r--asterisk.c20
-rw-r--r--cdr.c4
-rw-r--r--channel.c4
-rw-r--r--channels/chan_agent.c8
-rw-r--r--channels/chan_h323.c2
-rw-r--r--channels/chan_iax2.c10
-rw-r--r--channels/chan_mgcp.c16
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_modem.c6
-rw-r--r--channels/chan_phone.c2
-rw-r--r--channels/chan_sip.c56
-rw-r--r--channels/chan_skinny.c2
-rw-r--r--channels/chan_vpb.c2
-rw-r--r--channels/chan_zap.c32
-rw-r--r--channels/iax2-provision.c6
-rw-r--r--channels/misdn_config.c10
-rw-r--r--cli.c2
-rw-r--r--codecs/codec_speex.c8
-rw-r--r--dnsmgr.c2
-rw-r--r--frame.c2
-rw-r--r--funcs/func_math.c4
-rw-r--r--funcs/func_strings.c2
-rw-r--r--indications.c24
-rw-r--r--manager.c10
-rw-r--r--muted.c4
-rw-r--r--pbx.c14
-rw-r--r--pbx/dundi-parser.c2
-rw-r--r--pbx/pbx_config.c4
-rw-r--r--pbx/pbx_dundi.c20
-rw-r--r--pbx/pbx_loopback.c2
-rw-r--r--pbx/pbx_spool.c10
-rw-r--r--res/res_agi.c26
-rw-r--r--res/res_features.c8
-rw-r--r--res/res_osp.c10
-rw-r--r--utils/frame.c12
62 files changed, 246 insertions, 246 deletions
diff --git a/Makefile b/Makefile
index b6c013c42..0413ee64b 100644
--- a/Makefile
+++ b/Makefile
@@ -140,7 +140,7 @@ else
AGI_DIR=$(ASTVARLIBDIR)/agi-bin
endif
-ASTCFLAGS=
+ASTCFLAGS=-Wformat-security
# Pentium Pro Optimize
#PROC=i686
diff --git a/acl.c b/acl.c
index bef6ea7cc..9665f35e8 100644
--- a/acl.c
+++ b/acl.c
@@ -165,7 +165,7 @@ struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
nm++;
}
if (!strchr(nm, '.')) {
- if ((sscanf(nm, "%d", &x) == 1) && (x >= 0) && (x <= 32)) {
+ if ((sscanf(nm, "%30d", &x) == 1) && (x >= 0) && (x <= 32)) {
y = 0;
for (z=0;z<x;z++) {
y >>= 1;
@@ -250,7 +250,7 @@ int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *se
int ast_str2tos(const char *value, int *tos)
{
int fval;
- if (sscanf(value, "%i", &fval) == 1)
+ if (sscanf(value, "%30i", &fval) == 1)
*tos = fval & 0xff;
else if (!strcasecmp(value, "lowdelay"))
*tos = IPTOS_LOWDELAY;
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c
index 79fe30122..98398f06c 100644
--- a/apps/app_adsiprog.c
+++ b/apps/app_adsiprog.c
@@ -194,7 +194,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 */
@@ -204,7 +204,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 */
@@ -214,7 +214,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 6ef78f5eb..3c3812152 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -134,7 +134,7 @@ static void database_increment( char *key )
return;
}
- sscanf(value, "%u", &v);
+ sscanf(value, "%30u", &v);
v++;
if(option_verbose >= 4)
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 0d594996f..c70b113a9 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -426,7 +426,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;
diff --git a/apps/app_cut.c b/apps/app_cut.c
index a97405775..b1545d90f 100644
--- a/apps/app_cut.c
+++ b/apps/app_cut.c
@@ -134,7 +134,7 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz
*ptrvalue = '\0';
ptrvalue++;
sortable_keys[count2].key = ptrkey;
- sscanf(ptrvalue, "%f", &sortable_keys[count2].value);
+ sscanf(ptrvalue, "%30f", &sortable_keys[count2].value);
count2++;
}
@@ -206,15 +206,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/apps/app_dial.c b/apps/app_dial.c
index 834b7dc47..6b78720e9 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1706,7 +1706,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
if ((dialdata = strchr(announce, '|'))) {
*dialdata = '\0';
dialdata++;
- if (sscanf(dialdata, "%d", &sleep) == 1) {
+ if (sscanf(dialdata, "%30d", &sleep) == 1) {
sleep *= 1000;
} else {
ast_log(LOG_ERROR, "%s requires the numerical argument <sleep>\n",rapp);
@@ -1716,7 +1716,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
if ((dialdata = strchr(dialdata, '|'))) {
*dialdata = '\0';
dialdata++;
- if (sscanf(dialdata, "%d", &loops) != 1) {
+ if (sscanf(dialdata, "%30d", &loops) != 1) {
ast_log(LOG_ERROR, "%s requires the numerical argument <loops>\n",rapp);
LOCAL_USER_REMOVE(u);
return -1;
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 2ac124525..159129100 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -249,7 +249,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
if (j == '#') /* end of password */
{
/* see if this is an integer */
- if (sscanf(args.passcode,"%d",&j) < 1)
+ if (sscanf(args.passcode,"%30d",&j) < 1)
{ /* nope, it must be a filename */
fp = fopen(args.passcode,"r");
if (!fp)
@@ -274,7 +274,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox);
/* password must be in valid format (numeric) */
- if (sscanf(args.passcode,"%d",&j) < 1) continue;
+ if (sscanf(args.passcode,"%30d",&j) < 1) continue;
/* if we got it */
if (!strcmp(exten,args.passcode)) {
if (ast_strlen_zero(args.context))
diff --git a/apps/app_groupcount.c b/apps/app_groupcount.c
index 496f62b8f..b340d823c 100644
--- a/apps/app_groupcount.c
+++ b/apps/app_groupcount.c
@@ -180,7 +180,7 @@ static int group_check_exec(struct ast_channel *chan, void *data)
ast_app_group_split_group(args.max, limit, sizeof(limit), category, sizeof(category));
- if ((sscanf(limit, "%d", &max) == 1) && (max > -1)) {
+ if ((sscanf(limit, "%30d", &max) == 1) && (max > -1)) {
count = ast_app_group_get_count(pbx_builtin_getvar_helper(chan, category), category);
if (count > max) {
pbx_builtin_setvar_helper(chan, "CHECKGROUPSTATUS", "OVERMAX");
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 557155c71..249b56a02 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -169,12 +169,12 @@ static int macro_exec(struct ast_channel *chan, void *data)
/* does the user want a deeper rabbit hole? */
s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
if (s)
- sscanf(s, "%d", &maxdepth);
+ sscanf(s, "%3d", &maxdepth);
/* Count how many levels deep the rabbit hole goes */
tmp = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
if (tmp) {
- sscanf(tmp, "%d", &depth);
+ sscanf(tmp, "%3d", &depth);
} else {
depth = 0;
}
@@ -184,7 +184,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
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, "%3d", &inhangup);
if (depth >= maxdepth) {
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
@@ -442,7 +442,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
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_math.c b/apps/app_math.c
index f52385c02..adccf85bb 100644
--- a/apps/app_math.c
+++ b/apps/app_math.c
@@ -181,13 +181,13 @@ static int math_exec(struct ast_channel *chan, void *data)
return -1;
}
- if (sscanf(mvalue1, "%f", &fnum1) != 1) {
+ if (sscanf(mvalue1, "%30f", &fnum1) != 1) {
ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue1);
LOCAL_USER_REMOVE(u);
return -1;
}
- if (sscanf(mvalue2, "%f", &fnum2) != 1) {
+ if (sscanf(mvalue2, "%30f", &fnum2) != 1) {
ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue2);
LOCAL_USER_REMOVE(u);
return -1;
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 405dff9aa..005a6c6da 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -497,7 +497,7 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno);
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;
} else
ast_log(LOG_WARNING, "Out of memory\n");
@@ -806,7 +806,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, "%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
conf_map[confno_int] = 0;
conf_free(conf);
res = 1;
@@ -862,7 +862,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;
}
@@ -1901,7 +1901,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) {
res = ast_streamfile(chan, "conf-enteringno", chan->language);
if (!res) {
ast_waitstream(chan, "");
@@ -2020,7 +2020,7 @@ static struct ast_conf_user* find_user(struct ast_conference *conf, char *caller
return NULL;
}
- sscanf(callerident, "%i", &cid);
+ sscanf(callerident, "%30i", &cid);
AST_LIST_TRAVERSE(&conf->userlist, user, list) {
if (user->user_no == cid)
@@ -2179,7 +2179,7 @@ static void load_config(void)
return;
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 < ZT_DEFAULT_NUM_BUFS) || (audio_buffers > ZT_MAX_NUM_BUFS)) {
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index 9f3e2e32e..d487cfe25 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -336,7 +336,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);
@@ -346,7 +346,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);
@@ -356,7 +356,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_osplookup.c b/apps/app_osplookup.c
index f436d7cfa..5b45141b3 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -216,11 +216,11 @@ static int ospnext_exec(struct ast_channel *chan, void *data)
cause = str2cause(args.cause);
temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
result.handle = -1;
- if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.handle) != 1)) {
+ if (ast_strlen_zero(temp) || (sscanf(temp, "%30d", &result.handle) != 1)) {
result.handle = -1;
}
temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
- if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) {
+ if (ast_strlen_zero(temp) || (sscanf(temp, "%30d", &result.numresults) != 1)) {
result.numresults = 0;
}
if ((res = ast_osp_next(&result, cause)) > 0) {
@@ -301,7 +301,7 @@ static int ospfinished_exec(struct ast_channel *chan, void *data)
cause = str2cause(args.status);
temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
result.handle = -1;
- if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
+ if (!ast_strlen_zero(temp) && (sscanf(temp, "%30d", &result.handle) == 1) && (result.handle > -1)) {
if (!ast_osp_terminate(result.handle, cause, start, duration)) {
pbx_builtin_setvar_helper(chan, "_OSPHANDLE", "");
pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", "SUCCESS");
diff --git a/apps/app_privacy.c b/apps/app_privacy.c
index 09b1c1556..6196cd5c9 100644
--- a/apps/app_privacy.c
+++ b/apps/app_privacy.c
@@ -125,13 +125,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");
@@ -148,14 +148,14 @@ static int privacy_exec (struct ast_channel *chan, void *data)
cfg = ast_config_load(PRIV_CONFIG);
if (cfg && (s = ast_variable_retrieve(cfg, "general", "maxretries"))) {
- if (sscanf(s, "%d", &x) == 1)
+ if (sscanf(s, "%30d", &x) == 1)
maxretries = x;
else
ast_log(LOG_WARNING, "Invalid max retries argument\n");
}
if (cfg && (s = ast_variable_retrieve(cfg, "general", "minlength"))) {
- if (sscanf(s, "%d", &x) == 1)
+ if (sscanf(s, "%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 a9775328b..1bf241603 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2973,7 +2973,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;
}
@@ -3062,7 +3062,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) {
if (option_debug)
ast_log(LOG_DEBUG, "%s: Got priority %d from ${QUEUE_PRIO}.\n",
chan->name, prio);
@@ -3716,7 +3716,7 @@ static int manager_add_queue_member(struct mansession *s, struct message *m)
if (ast_strlen_zero(penalty_s))
penalty = 0;
- else if (sscanf(penalty_s, "%d", &penalty) != 1) {
+ else if (sscanf(penalty_s, "%30d", &penalty) != 1) {
penalty = 0;
}
@@ -3814,7 +3814,7 @@ static int handle_add_queue_member(int fd, int argc, char *argv[])
queuename = argv[5];
interface = argv[3];
if (argc == 8) {
- if (sscanf(argv[7], "%d", &penalty) == 1) {
+ if (sscanf(argv[7], "%30d", &penalty) == 1) {
if (penalty < 0) {
ast_cli(fd, "Penalty must be >= 0\n");
penalty = 0;
diff --git a/apps/app_random.c b/apps/app_random.c
index 789e04beb..caf328487 100644
--- a/apps/app_random.c
+++ b/apps/app_random.c
@@ -79,7 +79,7 @@ static int random_exec(struct ast_channel *chan, void *data)
}
prob = strsep(&s,":");
- if ((!prob) || (sscanf(prob, "%d", &probint) != 1))
+ if ((!prob) || (sscanf(prob, "%3d", &probint) != 1))
probint = 0;
if ((random() % 100) + probint >= 100) {
diff --git a/apps/app_readfile.c b/apps/app_readfile.c
index bc418aaa1..b97cd826f 100644
--- a/apps/app_readfile.c
+++ b/apps/app_readfile.c
@@ -89,7 +89,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 6d1dfcf21..78e74b01f 100644
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -146,7 +146,7 @@ static int record_exec(struct ast_channel *chan, void *data)
return -1;
}
if (silstr) {
- if ((sscanf(silstr, "%d", &i) == 1) && (i > -1)) {
+ if ((sscanf(silstr, "%30d", &i) == 1) && (i > -1)) {
silence = i * 1000;
} else if (!ast_strlen_zero(silstr)) {
ast_log(LOG_WARNING, "'%s' is not a valid silence duration\n", silstr);
@@ -154,7 +154,7 @@ static int record_exec(struct ast_channel *chan, void *data)
}
if (maxstr) {
- if ((sscanf(maxstr, "%d", &i) == 1) && (i > -1))
+ if ((sscanf(maxstr, "%30d", &i) == 1) && (i > -1))
/* Convert duration to milliseconds */
maxduration = i * 1000;
else if (!ast_strlen_zero(maxstr))
diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c
index fc9cd25bf..7dee44ea8 100644
--- a/apps/app_sayunixtime.c
+++ b/apps/app_sayunixtime.c
@@ -96,7 +96,7 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
timec = strsep(&s,"|");
if ((timec) && (*timec != '\0')) {
long timein;
- if (sscanf(timec,"%ld",&timein) == 1) {
+ if (sscanf(timec,"%30ld",&timein) == 1) {
unixtime = (time_t)timein;
}
}
diff --git a/apps/app_sms.c b/apps/app_sms.c
index 3a7677601..28293baff 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -748,7 +748,7 @@ static void sms_readfile (sms_t * h, char *fn)
H,
M,
S;
- if (sscanf (p, "%d-%d-%dT%d:%d:%d", &Y, &m, &d, &H, &M, &S) == 6)
+ if (sscanf (p, "%4d-%2d-%2dT%2d:%2d:%2d", &Y, &m, &d, &H, &M, &S) == 6)
{
struct tm t;
t.tm_year = Y - 1900;
diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c
index 11efe7068..3932a4b44 100644
--- a/apps/app_talkdetect.c
+++ b/apps/app_talkdetect.c
@@ -97,15 +97,15 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
strsep(&stringp, "|");
options = strsep(&stringp, "|");
if (options) {
- if ((sscanf(options, "%d", &x) == 1) && (x > 0))
+ if ((sscanf(options, "%30d", &x) == 1) && (x > 0))
sil = x;
options = strsep(&stringp, "|");
if (options) {
- if ((sscanf(options, "%d", &x) == 1) && (x > 0))
+ if ((sscanf(options, "%30d", &x) == 1) && (x > 0))
min = x;
options = strsep(&stringp, "|");
if (options) {
- if ((sscanf(options, "%d", &x) == 1) && (x > 0))
+ if ((sscanf(options, "%30d", &x) == 1) && (x > 0))
max = x;
}
}
diff --git a/apps/app_verbose.c b/apps/app_verbose.c
index 61c60abed..4c0601d9a 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)
if (vtext) {
char *tmp = strsep(&vtext, "|");
if (vtext) {
- if (sscanf(tmp, "%d", &vsize) != 1) {
+ if (sscanf(tmp, "%30d", &vsize) != 1) {
vsize = 0;
ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
}
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 5b31f41e6..a5b0dafa0 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -463,7 +463,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");
@@ -1042,7 +1042,7 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
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);
} else
@@ -1096,7 +1096,7 @@ static int message_exists(char *dir, int msgnum)
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
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);
} else
@@ -3695,7 +3695,7 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
time_t t;
long tin;
- if (sscanf(origtime,"%ld",&tin) < 1) {
+ if (sscanf(origtime,"%30ld",&tin) < 1) {
ast_log(LOG_WARNING, "Couldn't find origtime in %s\n", filename);
return 0;
}
@@ -5191,7 +5191,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "No value provided for record gain option\n");
LOCAL_USER_REMOVE(u);
return -1;
- } else if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) {
+ } else 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]);
LOCAL_USER_REMOVE(u);
return -1;
@@ -5633,7 +5633,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]);
LOCAL_USER_REMOVE(u);
return -1;
@@ -6067,7 +6067,7 @@ static int load_config(void)
vmmaxmessage = 0;
if ((s = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
- if (sscanf(s, "%d", &x) == 1) {
+ if (sscanf(s, "%30d", &x) == 1) {
vmmaxmessage = x;
} else {
ast_log(LOG_WARNING, "Invalid max message time length\n");
@@ -6076,7 +6076,7 @@ static int load_config(void)
vmminmessage = 0;
if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) {
- if (sscanf(s, "%d", &x) == 1) {
+ if (sscanf(s, "%30d", &x) == 1) {
vmminmessage = x;
if (maxsilence <= vmminmessage)
ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
@@ -6091,7 +6091,7 @@ static int load_config(void)
skipms = 3000;
if ((s = ast_variable_retrieve(cfg, "general", "maxgreet"))) {
- if (sscanf(s, "%d", &x) == 1) {
+ if (sscanf(s, "%30d", &x) == 1) {
maxgreet = x;
} else {
ast_log(LOG_WARNING, "Invalid max message greeting length\n");
@@ -6099,7 +6099,7 @@ static int load_config(void)
}
if ((s = ast_variable_retrieve(cfg, "general", "skipms"))) {
- if (sscanf(s, "%d", &x) == 1) {
+ if (sscanf(s, "%30d", &x) == 1) {
skipms = x;
} else {
ast_log(LOG_WARNING, "Invalid skipms value\n");
@@ -6108,7 +6108,7 @@ static int load_config(void)
maxlogins = 3;
if ((s = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
- if (sscanf(s, "%d", &x) == 1) {
+ if (sscanf(s, "%30d", &x) == 1) {
maxlogins = x;
} else {
ast_log(LOG_WARNING, "Invalid max failed login attempts\n");
@@ -6178,7 +6178,7 @@ static int load_config(void)
saydurationminfo = 2;
if ((astsaydurationminfo = ast_variable_retrieve(cfg, "general", "saydurationm"))) {
- if (sscanf(astsaydurationminfo, "%d", &x) == 1) {
+ if (sscanf(astsaydurationminfo, "%30d", &x) == 1) {
saydurationminfo = x;
} else {
ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
diff --git a/apps/app_waitforring.c b/apps/app_waitforring.c
index 25e651d9e..97e06877f 100644
--- a/apps/app_waitforring.c
+++ b/apps/app_waitforring.c
@@ -63,7 +63,7 @@ static int waitforring_exec(struct ast_channel *chan, void *data)
int res = 0;
int ms;
- if (!data || (sscanf(data, "%d", &ms) != 1)) {
+ if (!data || (sscanf(data, "%30d", &ms) != 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 64839f352..5f3067a33 100644
--- a/apps/app_waitforsilence.c
+++ b/apps/app_waitforsilence.c
@@ -157,8 +157,8 @@ static int waitforsilence_exec(struct ast_channel *chan, void *data)
res = ast_answer(chan); /* Answer the channel */
- if (!data || ((sscanf(data, "%d|%d", &maxsilence, &iterations) != 2) &&
- (sscanf(data, "%d", &maxsilence) != 1))) {
+ if (!data || ((sscanf(data, "%30d|%30d", &maxsilence, &iterations) != 2) &&
+ (sscanf(data, "%30d", &maxsilence) != 1))) {
ast_log(LOG_WARNING, "Using default value of 1000ms, 1 iteration\n");
}
diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c
index 9fea023ed..416cbce73 100644
--- a/apps/app_zapbarge.c
+++ b/apps/app_zapbarge.c
@@ -272,8 +272,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
if (!ast_strlen_zero(data)) {
- if ((sscanf(data, "Zap/%d", &confno) != 1) &&
- (sscanf(data, "%d", &confno) != 1)) {
+ if ((sscanf(data, "Zap/%3d", &confno) != 1) &&
+ (sscanf(data, "%3d", &confno) != 1)) {
ast_log(LOG_WARNING, "ZapBarge Argument (if specified) must be a channel number, not '%s'\n", (char *)data);
LOCAL_USER_REMOVE(u);
return 0;
@@ -288,7 +288,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, "%3d", &confno) != 1)
confno = 0;
}
if (confno) {
diff --git a/asterisk.c b/asterisk.c
index c7acd0128..8114f664a 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -706,7 +706,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));
@@ -1357,10 +1357,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;
}
@@ -1405,9 +1405,9 @@ static char *cli_prompt(EditLine *el)
if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
float avg1, avg2, avg3;
int actproc, totproc, npid, which;
- fscanf(LOADAVG, "%f %f %f %d/%d %d",
+ fscanf(LOADAVG, "%30f %30f %30f %30d/%30d %30d",
&avg1, &avg2, &avg3, &actproc, &totproc, &npid);
- if (sscanf(t, "%d", &which) == 1) {
+ if (sscanf(t, "%30d", &which) == 1) {
switch (which) {
case 1:
snprintf(p, sizeof(prompt) - strlen(prompt), "%.2f", avg1);
@@ -1949,7 +1949,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);
}
/* Disable forking (-f at startup) */
@@ -1989,7 +1989,7 @@ static void ast_readconfig(void) {
} else if (!strcasecmp(v->name, "transmit_silence_during_record")) {
option_transmit_silence_during_record = ast_true(v->value);
} 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")) {
@@ -1998,7 +1998,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;
}
/* What user to run as */
@@ -2118,11 +2118,11 @@ int main(int argc, char *argv[])
option_nofork++;
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/cdr.c b/cdr.c
index 01385d85e..462e07b9b 100644
--- a/cdr.c
+++ b/cdr.c
@@ -1193,7 +1193,7 @@ static int do_reload(void)
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 (size_value < 0)
ast_log(LOG_WARNING, "Invalid maximum batch size '%d' specified, using default\n", cfg_size);
@@ -1201,7 +1201,7 @@ static int do_reload(void)
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 (time_value < 0)
ast_log(LOG_WARNING, "Invalid maximum batch time '%d' specified, using default\n", cfg_time);
diff --git a/channel.c b/channel.c
index 5f8a9f99d..8329bb1f4 100644
--- a/channel.c
+++ b/channel.c
@@ -3875,9 +3875,9 @@ ast_group_t ast_get_group(char *s)
c = copy;
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/channels/chan_agent.c b/channels/chan_agent.c
index 53d7d1067..87b49839a 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1296,9 +1296,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 {
@@ -2405,9 +2405,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);
waitforagent = 1;
} else {
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index b2d4d8184..082e5de46 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -2037,7 +2037,7 @@ int reload_config(void)
memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
}
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &format)) {
+ if (sscanf(v->value, "%30d", &format)) {
tos = format & 0xff;
} else if (!strcasecmp(v->value, "lowdelay")) {
tos = IPTOS_LOWDELAY;
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index dcae68853..daaa51a77 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -2814,7 +2814,7 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in
break;
}
} else if (!strcasecmp(tmp->name, "regseconds")) {
- if (sscanf(tmp->value, "%ld", (time_t *)&regseconds) != 1)
+ if (sscanf(tmp->value, "%30ld", (time_t *)&regseconds) != 1)
regseconds = 0;
} else if (!strcasecmp(tmp->name, "ipaddr")) {
inet_aton(tmp->value, &(peer->addr.sin_addr));
@@ -8787,18 +8787,18 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, in
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")) {
@@ -9272,7 +9272,7 @@ static int set_config(char *config_file, int reload)
if (trunkfreq < 10)
trunkfreq = 10;
} 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 de2d6a400..482e868eb 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1793,7 +1793,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;
}
@@ -1808,7 +1808,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);
@@ -1824,7 +1824,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 %[^/]/", &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);
@@ -1958,7 +1958,7 @@ static int transmit_response(struct mgcp_subchannel *sub, char *msg, struct mgcp
if (mgr) {
/* Store MGCP response in case we have to retransmit */
memset(mgr, 0, sizeof(struct mgcp_response));
- 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);
@@ -3246,7 +3246,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) {
@@ -3305,7 +3305,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) {
@@ -4119,7 +4119,7 @@ static int reload_config(void)
else
capability &= ~format;
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &format) == 1)
+ if (sscanf(v->value, "%30d", &format) == 1)
tos = format & 0xff;
else if (!strcasecmp(v->value, "lowdelay"))
tos = IPTOS_LOWDELAY;
@@ -4134,7 +4134,7 @@ static int reload_config(void)
else
ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
} else if (!strcasecmp(v->name, "port")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%30d", &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 cf5ea13f6..8e4e8f9ac 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -787,7 +787,7 @@ static int misdn_show_config (int fd, int argc, char *argv[])
int onlyport = -1;
if (argc >= 4) {
- if (!sscanf(argv[3], "%d", &onlyport) || onlyport < 0) {
+ if (!sscanf(argv[3], "%30d", &onlyport) || onlyport < 0) {
ast_cli(fd, "Unknown option: %s\n", argv[3]);
return RESULT_SHOWUSAGE;
}
diff --git a/channels/chan_modem.c b/channels/chan_modem.c
index d95d175bb..a5d11c4a6 100644
--- a/channels/chan_modem.c
+++ b/channels/chan_modem.c
@@ -835,7 +835,7 @@ static struct ast_channel *modem_request(const char *type, int format, void *dat
if (dev[0]=='g' && isdigit(dev[1])) {
/* Retrieve the group number */
- if (sscanf(dev+1, "%u", &groupint) < 1) {
+ if (sscanf(dev+1, "%30u", &groupint) < 1) {
ast_log(LOG_WARNING, "Unable to determine group from [%s]\n", (char *)data);
return NULL;
}
@@ -898,9 +898,9 @@ static ast_group_t get_group(char *s)
stringp=copy;
piece = strsep(&stringp, ",");
while(piece) {
- 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/channels/chan_phone.c b/channels/chan_phone.c
index 54cadc208..1b9ac8309 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -1216,7 +1216,7 @@ static int parse_gain_value(char *gain_type, 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 d13e453c0..5ad323b7b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2095,7 +2095,7 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout)
res = 0;
ast_set_flag(p, SIP_OUTGOING);
#ifdef OSP_SUPPORT
- if (!p->options->osptoken || !osphandle || (sscanf(osphandle, "%d", &p->osphandle) != 1)) {
+ if (!p->options->osptoken || !osphandle || (sscanf(osphandle, "%30d", &p->osphandle) != 1)) {
/* Force Disable OSP support */
ast_log(LOG_DEBUG, "Disabling OSP support for this call. osptoken = %s, osphandle = %s\n", p->options->osptoken, osphandle);
p->options->osptoken = NULL;
@@ -3638,15 +3638,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
ast_set_flag(p, SIP_NOVIDEO);
while ((m = get_sdp_iterate(&iterator, req, "m"))[0] != '\0') {
int found = 0;
- if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &y, &len) == 2) ||
- (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) {
+ if ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &y, &len) == 2) ||
+ (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1)) {
found = 1;
portno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
ast_rtp_pt_clear(p->rtp);
codecs = m + len;
while(!ast_strlen_zero(codecs)) {
- 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;
}
@@ -3659,14 +3659,14 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
if (p->vrtp)
ast_rtp_pt_clear(p->vrtp); /* Must be cleared in case no m=video line exists */
- if (p->vrtp && (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) {
+ if (p->vrtp && (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1)) {
found = 1;
ast_clear_flag(p, SIP_NOVIDEO);
vportno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
codecs = m + len;
while(!ast_strlen_zero(codecs)) {
- 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;
}
@@ -3747,7 +3747,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
if (!strcasecmp(a, "sendrecv")) {
sendonly = 0;
}
- if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue;
+ if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) != 2) continue;
if (debug)
ast_verbose("Found description format %s\n", mimeSubtype);
/* Note: should really look at the 'freq' and '#chans' params too */
@@ -4324,7 +4324,7 @@ static int __transmit_response(struct sip_pvt *p, char *msg, struct sip_request
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;
}
@@ -4443,7 +4443,7 @@ static int transmit_response_with_auth(struct sip_pvt *p, char *msg, struct sip_
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;
}
@@ -4755,7 +4755,7 @@ static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_r
{
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;
}
@@ -6078,7 +6078,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
char *ptr;
if ((ptr = strchr(expires, ';')))
*ptr = '\0';
- if (sscanf(expires + 9, "%d", &expiry) != 1)
+ if (sscanf(expires + 9, "%30d", &expiry) != 1)
expiry = default_expiry;
} else {
/* Nothing has been specified */
@@ -10103,7 +10103,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;
}
@@ -11430,7 +11430,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
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;
}
@@ -11465,7 +11465,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
ignore=1;
} else if (e) {
e = ast_skip_blanks(e);
- if (sscanf(e, "%d %n", &respid, &len) != 1) {
+ if (sscanf(e, "%30d %n", &respid, &len) != 1) {
ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
} else {
/* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */
@@ -12659,7 +12659,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
}
if (realtime && !strcasecmp(v->name, "regseconds")) {
- if (sscanf(v->value, "%ld", (time_t *)&regseconds) != 1)
+ if (sscanf(v->value, "%30ld", (time_t *)&regseconds) != 1)
regseconds = 0;
} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
inet_aton(v->value, &(peer->addr.sin_addr));
@@ -12774,17 +12774,17 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
} else if (!strcasecmp(v->name, "disallow")) {
ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, 0);
} 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;
}
@@ -12804,7 +12804,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
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 sip.conf\n", peer->name, v->lineno);
peer->maxms = 0;
}
@@ -12952,24 +12952,24 @@ static int reload_config(void)
} else if (!strcasecmp(v->name, "relaxdtmf")) {
relaxdtmf = ast_true(v->value);
} else if (!strcasecmp(v->name, "checkmwi")) {
- if ((sscanf(v->value, "%d", &global_mwitime) != 1) || (global_mwitime < 0)) {
+ if ((sscanf(v->value, "%30d", &global_mwitime) != 1) || (global_mwitime < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid MWI time setting at line %d. Using default (10).\n", v->value, v->lineno);
global_mwitime = DEFAULT_MWITIME;
}
} else if (!strcasecmp(v->name, "vmexten")) {
ast_copy_string(global_vmexten, v->value, sizeof(global_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;
}
@@ -13001,7 +13001,7 @@ static int reload_config(void)
ast_log(LOG_WARNING, "Unable to locate host '%s'\n", v->value);
} else if (!strcasecmp(v->name, "outboundproxyport")) {
/* Port needs to be after IP */
- sscanf(v->value, "%d", &format);
+ sscanf(v->value, "%30d", &format);
outboundproxyip.sin_port = htons(format);
} else if (!strcasecmp(v->name, "autocreatepeer")) {
autocreatepeer = ast_true(v->value);
@@ -13058,7 +13058,7 @@ static int reload_config(void)
memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr));
time(&externexpire);
} 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;
}
@@ -13089,7 +13089,7 @@ static int reload_config(void)
if (ast_str2tos(v->value, &tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
} else if (!strcasecmp(v->name, "bindport")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%30d", &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);
@@ -13099,7 +13099,7 @@ static int reload_config(void)
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;
}
@@ -13531,7 +13531,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 (!strlen(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 c9d3f8854..2c0d8d226 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -3125,7 +3125,7 @@ static int reload_config(void)
capability &= ~format;
}
} else if (!strcasecmp(v->name, "port")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%30d", &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_vpb.c b/channels/chan_vpb.c
index 0b067124b..6305034dc 100644
--- a/channels/chan_vpb.c
+++ b/channels/chan_vpb.c
@@ -2758,7 +2758,7 @@ static float parse_gain_value(char *gain_type, 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);
return DEFAULT_GAIN;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 8589de432..36b06529e 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -7666,7 +7666,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
char *stringp=NULL;
stringp=dest + 1;
s = strsep(&stringp, "/");
- if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+ if ((res = sscanf(s, "%30d%c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine group for data %s\n", (char *)data);
return NULL;
}
@@ -7701,7 +7701,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
channelmatch = x;
}
#ifdef ZAPATA_PRI
- else if ((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) > 1) {
+ else if ((res = sscanf(s, "%30d:%30d%c%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;
@@ -7724,7 +7724,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
p = pris[x].crvs;
}
#endif
- else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+ else if ((res = sscanf(s, "%30d%c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data);
return NULL;
} else {
@@ -9797,7 +9797,7 @@ static int zap_show_channel(int fd, int argc, char **argv)
return RESULT_SHOWUSAGE;
#ifdef ZAPATA_PRI
if ((c = strchr(argv[3], ':'))) {
- if (sscanf(argv[3], "%d:%d", &trunkgroup, &channel) != 2)
+ if (sscanf(argv[3], "%30d:%30d", &trunkgroup, &channel) != 2)
return RESULT_SHOWUSAGE;
if ((trunkgroup < 1) || (channel < 1))
return RESULT_SHOWUSAGE;
@@ -10423,7 +10423,7 @@ static int setup_zap(int reload)
#ifdef ZAPATA_PRI
pri = NULL;
if (!strcasecmp(v->name, "crv")) {
- 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", v->lineno);
ast_config_destroy(cfg);
ast_mutex_unlock(&iflock);
@@ -10452,9 +10452,9 @@ static int setup_zap(int reload)
#endif
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 if (!strcasecmp(chan, "pseudo")) {
@@ -10511,13 +10511,13 @@ static int setup_zap(int reload)
ast_copy_string(drings.ringContext[2].contextData,v->value,sizeof(drings.ringContext[2].contextData));
} else if (!strcasecmp(v->name, "dring1")) {
ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
+ sscanf(ringc, "%30d,%30d,%30d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
} else if (!strcasecmp(v->name, "dring2")) {
ringc = v->value;
- sscanf(ringc,"%d,%d,%d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
+ sscanf(ringc,"%30d,%30d,%30d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
} else if (!strcasecmp(v->name, "dring3")) {
ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
+ sscanf(ringc, "%30d,%30d,%30d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
} else if (!strcasecmp(v->name, "usecallerid")) {
chan_conf.use_callerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "cidsignalling")) {
@@ -10560,7 +10560,7 @@ static int setup_zap(int reload)
} else if (!strcasecmp(v->name, "busycount")) {
chan_conf.busycount = atoi(v->value);
} else if (!strcasecmp(v->name, "busypattern")) {
- if (sscanf(v->value, "%d,%d", &chan_conf.busy_tonelength, &chan_conf.busy_quietlength) != 2) {
+ if (sscanf(v->value, "%30d,%30d", &chan_conf.busy_tonelength, &chan_conf.busy_quietlength) != 2) {
ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength\n");
}
} else if (!strcasecmp(v->name, "callprogress")) {
@@ -10592,7 +10592,7 @@ static int setup_zap(int reload)
chan_conf.echocancel=128;
}
} 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 2000 ms at line %d\n", v->lineno);
} else {
@@ -10635,15 +10635,15 @@ static int setup_zap(int reload)
} else if (!strcasecmp(v->name, "transfertobusy")) {
chan_conf.transfertobusy = ast_true(v->value);
} else if (!strcasecmp(v->name, "rxgain")) {
- if (sscanf(v->value, "%f", &chan_conf.rxgain) != 1) {
+ if (sscanf(v->value, "%30f", &chan_conf.rxgain) != 1) {
ast_log(LOG_WARNING, "Invalid rxgain: %s\n", v->value);
}
} else if (!strcasecmp(v->name, "txgain")) {
- if (sscanf(v->value, "%f", &chan_conf.txgain) != 1) {
+ if (sscanf(v->value, "%30f", &chan_conf.txgain) != 1) {
ast_log(LOG_WARNING, "Invalid txgain: %s\n", v->value);
}
} else if (!strcasecmp(v->name, "tonezone")) {
- if (sscanf(v->value, "%d", &chan_conf.tonezone) != 1) {
+ if (sscanf(v->value, "%30d", &chan_conf.tonezone) != 1) {
ast_log(LOG_WARNING, "Invalid tonezone: %s\n", v->value);
}
} else if (!strcasecmp(v->name, "callerid")) {
@@ -10944,7 +10944,7 @@ static int setup_zap(int reload)
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/iax2-provision.c b/channels/iax2-provision.c
index b7ef989d3..c05aa0160 100644
--- a/channels/iax2-provision.c
+++ b/channels/iax2-provision.c
@@ -242,7 +242,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)
@@ -301,7 +301,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;
@@ -327,7 +327,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
} else
ast_log(LOG_WARNING, "Ignoring invalid codec '%s' for '%s' at line %d\n", v->value, s, v->lineno);
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &x) == 1)
+ if (sscanf(v->value, "%3d", &x) == 1)
cur->tos = x & 0xff;
else if (!strcasecmp(v->value, "lowdelay"))
cur->tos = IPTOS_LOWDELAY;
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index b2c4289fd..5324af63f 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -556,9 +556,9 @@ static int _parse (union misdn_cfg_pt *dest, char *value, enum misdn_cfg_type ty
{
char *pat;
if (strchr(value,'x'))
- pat="%x";
+ pat="%30x";
else
- pat="%d";
+ pat="%30d";
if (sscanf(value, pat, &tmp)) {
dest->num = (int *)malloc(sizeof(int));
memcpy(dest->num, &tmp, sizeof(int));
@@ -572,7 +572,7 @@ static int _parse (union misdn_cfg_pt *dest, char *value, enum misdn_cfg_type ty
break;
case MISDN_CTYPE_BOOLINT:
dest->num = (int *)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);
@@ -639,7 +639,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
for (token = strsep(&v->value, ","); token; token = strsep(&v->value, ","), *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;
@@ -648,7 +648,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/cli.c b/cli.c
index 4a96624ee..7e71ce2bf 100644
--- a/cli.c
+++ b/cli.c
@@ -643,7 +643,7 @@ static int handle_debuglevel(int fd, int argc, char *argv[])
char *filename = "<any>";
if ((argc < 3) || (argc > 4))
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2], "%d", &newlevel) != 1)
+ if (sscanf(argv[2], "%5d", &newlevel) != 1)
return RESULT_SHOWUSAGE;
option_debug = newlevel;
if (argc == 4) {
diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c
index 24a6704a9..7400c4ad0 100644
--- a/codecs/codec_speex.c
+++ b/codecs/codec_speex.c
@@ -451,7 +451,7 @@ static void parse_config(void)
} 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) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting VBR Quality to %f\n",res_f);
ast_mutex_lock(&localuser_lock);
@@ -518,7 +518,7 @@ static void parse_config(void)
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
ast_mutex_unlock(&localuser_lock);
} 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) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
ast_mutex_lock(&localuser_lock);
@@ -539,7 +539,7 @@ static void parse_config(void)
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
ast_mutex_unlock(&localuser_lock);
} 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) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
ast_mutex_lock(&localuser_lock);
@@ -548,7 +548,7 @@ static void parse_config(void)
} 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) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
ast_mutex_lock(&localuser_lock);
diff --git a/dnsmgr.c b/dnsmgr.c
index 75fcdd830..587e0ab39 100644
--- a/dnsmgr.c
+++ b/dnsmgr.c
@@ -324,7 +324,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/frame.c b/frame.c
index ddb61d6fb..a27d4161d 100644
--- a/frame.c
+++ b/frame.c
@@ -653,7 +653,7 @@ static int show_codec_n(int fd, int argc, char *argv[])
if (argc != 3)
return RESULT_SHOWUSAGE;
- if (sscanf(argv[2],"%d",&codec) != 1)
+ if (sscanf(argv[2],"%30d",&codec) != 1)
return RESULT_SHOWUSAGE;
for (i=0;i<32;i++)
diff --git a/funcs/func_math.c b/funcs/func_math.c
index 4795efcc6..e456d1af6 100644
--- a/funcs/func_math.c
+++ b/funcs/func_math.c
@@ -159,12 +159,12 @@ static char *builtin_function_math(struct ast_channel *chan, char *cmd, char *da
return NULL;
}
- 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 NULL;
}
- 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 NULL;
}
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index 0aaf3fc4b..9ce8b08d2 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -169,7 +169,7 @@ static char *acf_strftime(struct ast_channel *chan, char *cmd, char *data, char
epoch = strsep(&format, "|");
timezone = strsep(&format, "|");
- if (ast_strlen_zero(epoch) || !sscanf(epoch, "%ld", &epochi)) {
+ if (ast_strlen_zero(epoch) || !sscanf(epoch, "%30ld", &epochi)) {
struct timeval tv = ast_tvnow();
epochi = tv.tv_sec;
}
diff --git a/indications.c b/indications.c
index e9ca85d9c..e18ca146b 100644
--- a/indications.c
+++ b/indications.c
@@ -238,46 +238,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/manager.c b/manager.c
index bddd2bc6a..d3bf56680 100644
--- a/manager.c
+++ b/manager.c
@@ -870,7 +870,7 @@ static int action_redirect(struct mansession *s, 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)) {
astman_send_error(s, m, "Invalid priority\n");
return 0;
}
@@ -1027,11 +1027,11 @@ static int action_originate(struct mansession *s, 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)) {
astman_send_error(s, m, "Invalid priority\n");
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\n");
return 0;
}
@@ -1696,12 +1696,12 @@ int init_manager(void)
block_sockets = ast_true(val);
if ((val = ast_variable_retrieve(cfg, "general", "port"))) {
- if (sscanf(val, "%d", &portno) != 1) {
+ if (sscanf(val, "%5d", &portno) != 1) {
ast_log(LOG_WARNING, "Invalid port number '%s'\n", val);
portno = DEFAULT_MANAGER_PORT;
}
} else if ((val = ast_variable_retrieve(cfg, "general", "portno"))) {
- if (sscanf(val, "%d", &portno) != 1) {
+ if (sscanf(val, "%5d", &portno) != 1) {
ast_log(LOG_WARNING, "Invalid port number '%s'\n", val);
portno = DEFAULT_MANAGER_PORT;
}
diff --git a/muted.c b/muted.c
index 600892cad..9ce7326ae 100644
--- a/muted.c
+++ b/muted.c
@@ -139,7 +139,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, "%30d", &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);
@@ -199,7 +199,7 @@ static int connect_asterisk(void)
if (ports) {
*ports = '\0';
ports++;
- if ((sscanf(ports, "%d", &port) != 1) || (port < 1) || (port > 65535)) {
+ if ((sscanf(ports, "%30d", &port) != 1) || (port < 1) || (port > 65535)) {
fprintf(stderr, "'%s' is not a valid port number in the hostname\n", ports);
return -1;
}
diff --git a/pbx.c b/pbx.c
index 2b2edc211..bded93549 100644
--- a/pbx.c
+++ b/pbx.c
@@ -950,7 +950,7 @@ static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
}
pvn_endfor:
if (offsetchar) {
- sscanf(offsetchar, "%d:%d", offset, length);
+ sscanf(offsetchar, "%30d:%30d", offset, length);
return 1;
} else {
return 0;
@@ -3890,11 +3890,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;
}
@@ -4016,7 +4016,7 @@ static unsigned int get_day(char *day)
c++;
}
/* Find the start */
- if (sscanf(day, "%d", &s) != 1) {
+ if (sscanf(day, "%1d", &s) != 1) {
ast_log(LOG_WARNING, "Invalid day '%s', assuming none\n", day);
return 0;
}
@@ -4026,7 +4026,7 @@ static unsigned int get_day(char *day)
}
s--;
if (c) {
- if (sscanf(c, "%d", &e) != 1) {
+ if (sscanf(c, "%1d", &e) != 1) {
ast_log(LOG_WARNING, "Invalid day '%s', assuming none\n", c);
return 0;
}
@@ -5422,7 +5422,7 @@ static void wait_for_hangup(struct ast_channel *chan, void *data)
struct ast_frame *f;
int waittime;
- if (ast_strlen_zero(data) || (sscanf(data, "%d", &waittime) != 1) || (waittime < 0))
+ if (ast_strlen_zero(data) || (sscanf(data, "%30d", &waittime) != 1) || (waittime < 0))
waittime = -1;
if (waittime > -1) {
ast_safe_sleep(chan, waittime * 1000);
@@ -6537,7 +6537,7 @@ int ast_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 && strcasecmp(exten, "BYEXTENSION")) ? 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/pbx/dundi-parser.c b/pbx/dundi-parser.c
index 9b9d9d205..9ff70f952 100644
--- a/pbx/dundi-parser.c
+++ b/pbx/dundi-parser.c
@@ -91,7 +91,7 @@ int dundi_str_to_eid(dundi_eid *eid, 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;
for (x=0;x<6;x++)
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 5e850a2bf..5151ea0e3 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1192,7 +1192,7 @@ static int handle_context_add_extension(int fd, int argc, char *argv[])
if (!strcmp(prior, "hint")) {
iprior = PRIORITY_HINT;
} else {
- if (sscanf(prior, "%d", &iprior) != 1) {
+ if (sscanf(prior, "%30d", &iprior) != 1) {
ast_cli(fd, "'%s' is not a valid priority\n", prior);
prior = NULL;
}
@@ -1708,7 +1708,7 @@ static int pbx_load_module(void)
else
ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n");
} else {
- if (sscanf(pri, "%d", &ipri) != 1) {
+ if (sscanf(pri, "%30d", &ipri) != 1) {
if ((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/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 8b87c8ec9..15792e3c6 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -1155,12 +1155,12 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
/* Build request string */
if (!ast_db_get("dundi/cache", key, data, sizeof(data))) {
ptr = data;
- if (sscanf(ptr, "%d|%n", (int *)&timeout, &length) == 1) {
+ if (sscanf(ptr, "%30d|%n", (int *)&timeout, &length) == 1) {
expiration = timeout - now;
if (expiration > 0) {
ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", (int)(timeout - now));
ptr += length;
- 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) {
@@ -2050,7 +2050,7 @@ static void load_password(void)
time_t expired;
ast_db_get(secretpath, "secretexpiry", tmp, sizeof(tmp));
- if (sscanf(tmp, "%d", (int *)&expired) == 1) {
+ if (sscanf(tmp, "%30d", (int *)&expired) == 1) {
ast_db_get(secretpath, "secret", tmp, sizeof(tmp));
current = strchr(tmp, ';');
if (!current)
@@ -4169,7 +4169,7 @@ static void build_mapping(char *name, 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 < 60000)) {
+ if ((sscanf(fields[1], "%30d", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) {
ast_copy_string(map->dest, fields[3], sizeof(map->dest));
if ((map->tech = str2tech(fields[2]))) {
map->dead = 0;
@@ -4272,7 +4272,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, "%30d:%30d", &port, &expire) == 2) {
/* Got it! */
inet_aton(data, &peer->addr.sin_addr);
peer->addr.sin_family = AF_INET;
@@ -4377,7 +4377,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;
@@ -4613,14 +4613,14 @@ static int set_config(char *config_file, struct sockaddr_in* sin)
} 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
@@ -4636,7 +4636,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin)
else
ast_log(LOG_WARNING, "Invalid global endpoint identifier '%s' at line %d\n", v->value, v->lineno);
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &format) == 1)
+ if (sscanf(v->value, "%30d", &format) == 1)
tos = format & 0xff;
else if (!strcasecmp(v->value, "lowdelay"))
tos = IPTOS_LOWDELAY;
@@ -4673,7 +4673,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin)
} 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 5522e9b09..ec7199506 100644
--- a/pbx/pbx_loopback.c
+++ b/pbx/pbx_loopback.c
@@ -126,7 +126,7 @@ static void loopback_subst(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 1141b85a1..15e0222a8 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -168,7 +168,7 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
} else if (!strcasecmp(buf, "data")) {
strncpy(o->data, c, sizeof(o->data) - 1);
} 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;
}
@@ -177,24 +177,24 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
} else if (!strcasecmp(buf, "extension")) {
strncpy(o->exten, c, sizeof(o->exten) - 1);
} 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 retrytime 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, "%d", &o->callingpid) != 1) {
+ if (sscanf(c, "%30d", &o->callingpid) != 1) {
ast_log(LOG_WARNING, "Unable to retrieve calling PID!\n");
o->callingpid = 0;
}
diff --git a/res/res_agi.c b/res/res_agi.c
index 53cafd58c..85a701ee0 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -399,7 +399,7 @@ static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, cha
int to;
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);
fdprintf(agi->fd, "200 result=%d\n", res);
@@ -518,7 +518,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]))
@@ -557,7 +557,7 @@ static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SHOWUSAGE;
if (argc > 5)
return RESULT_SHOWUSAGE;
- if ((argc > 4) && (sscanf(argv[4], "%ld", &sample_offset) != 1))
+ if ((argc > 4) && (sscanf(argv[4], "%30ld", &sample_offset) != 1))
return RESULT_SHOWUSAGE;
fs = ast_openstream(chan, argv[2], chan->language);
@@ -660,7 +660,7 @@ static int handle_saynumber(struct ast_channel *chan, AGI *agi, int argc, char *
int num;
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_number_full(chan, num, argv[3], chan->language, (char *) NULL, agi->audio, agi->ctrl);
if (res == 1)
@@ -679,7 +679,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);
@@ -715,7 +715,7 @@ static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, char *ar
int num;
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)
@@ -733,7 +733,7 @@ static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *ar
int num;
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)
@@ -767,7 +767,7 @@ static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, char
if (argc > 5 && !ast_strlen_zero(argv[5]))
zone = argv[5];
- if (sscanf(argv[2], "%ld", &unixtime) != 1)
+ if (sscanf(argv[2], "%30ld", &unixtime) != 1)
return RESULT_SHOWUSAGE;
res = ast_say_date_with_format(chan, (time_t) unixtime, argv[3], chan->language, format, zone);
@@ -853,7 +853,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;
}
@@ -885,7 +885,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)
@@ -926,7 +926,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], '=')))
@@ -1044,7 +1044,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;
@@ -1215,7 +1215,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);
switch (level) {
case 4:
diff --git a/res/res_features.c b/res/res_features.c
index 756733fc1..0add7bab9 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -2004,13 +2004,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 parking.conf\n", var->lineno);
} else {
parking_start = start;
@@ -2021,13 +2021,13 @@ 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;
}
diff --git a/res/res_osp.c b/res/res_osp.c
index 41ca8c0cf..f2aa60a0f 100644
--- a/res/res_osp.c
+++ b/res/res_osp.c
@@ -167,22 +167,22 @@ static int osp_build(struct ast_config *cfg, char *cat)
} else
ast_log(LOG_WARNING, "Too many Service points at line %d\n", v->lineno);
} else if (!strcasecmp(v->name, "maxconnections")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x <= 1000)) {
+ if ((sscanf(v->value, "%30d", &x) == 1) && (x > 0) && (x <= 1000)) {
osp->maxconnections = x;
} else
ast_log(LOG_WARNING, "maxconnections should be an integer from 1 to 1000, not '%s' at line %d\n", v->value, v->lineno);
} else if (!strcasecmp(v->name, "retrydelay")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x >= 0) && (x <= 10)) {
+ if ((sscanf(v->value, "%30d", &x) == 1) && (x >= 0) && (x <= 10)) {
osp->retrydelay = x;
} else
ast_log(LOG_WARNING, "retrydelay should be an integer from 0 to 10, not '%s' at line %d\n", v->value, v->lineno);
} else if (!strcasecmp(v->name, "retrylimit")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x >= 0) && (x <= 100)) {
+ if ((sscanf(v->value, "%30d", &x) == 1) && (x >= 0) && (x <= 100)) {
osp->retrylimit = x;
} else
ast_log(LOG_WARNING, "retrylimit should be an integer from 0 to 100, not '%s' at line %d\n", v->value, v->lineno);
} else if (!strcasecmp(v->name, "timeout")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x >= 200) && (x <= 10000)) {
+ if ((sscanf(v->value, "%30d", &x) == 1) && (x >= 200) && (x <= 10000)) {
osp->timeout = x;
} else
ast_log(LOG_WARNING, "timeout should be an integer from 200 to 10000, not '%s' at line %d\n", v->value, v->lineno);
@@ -809,7 +809,7 @@ static int config_load(void)
}
cat = ast_variable_retrieve(cfg, "general", "tokenformat");
if (cat) {
- if ((sscanf(cat, "%d", &tokenformat) != 1) || (tokenformat < TOKEN_ALGO_SIGNED) || (tokenformat > TOKEN_ALGO_BOTH)) {
+ if ((sscanf(cat, "%30d", &tokenformat) != 1) || (tokenformat < TOKEN_ALGO_SIGNED) || (tokenformat > TOKEN_ALGO_BOTH)) {
tokenformat = TOKEN_ALGO_SIGNED;
ast_log(LOG_WARNING, "tokenformat should be an integer from 0 to 2, not '%s'\n", cat);
}
diff --git a/utils/frame.c b/utils/frame.c
index 7fdb1637d..05f54d162 100644
--- a/utils/frame.c
+++ b/utils/frame.c
@@ -299,7 +299,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:
@@ -340,7 +340,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:
@@ -420,7 +420,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);
@@ -454,7 +454,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);
@@ -489,7 +489,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;
@@ -537,7 +537,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: