]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
AST-2009-005
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 10 Aug 2009 19:12:35 +0000 (19:12 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 10 Aug 2009 19:12:35 +0000 (19:12 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@211526 65c4cc65-6c06-0410-ace0-fbb531ad65f3

62 files changed:
Makefile
acl.c
apps/app_adsiprog.c
apps/app_alarmreceiver.c
apps/app_chanspy.c
apps/app_cut.c
apps/app_dial.c
apps/app_disa.c
apps/app_groupcount.c
apps/app_macro.c
apps/app_math.c
apps/app_meetme.c
apps/app_mixmonitor.c
apps/app_osplookup.c
apps/app_privacy.c
apps/app_queue.c
apps/app_random.c
apps/app_readfile.c
apps/app_record.c
apps/app_sayunixtime.c
apps/app_sms.c
apps/app_talkdetect.c
apps/app_verbose.c
apps/app_voicemail.c
apps/app_waitforring.c
apps/app_waitforsilence.c
apps/app_zapbarge.c
asterisk.c
cdr.c
channel.c
channels/chan_agent.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_modem.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_vpb.c
channels/chan_zap.c
channels/iax2-provision.c
channels/misdn_config.c
cli.c
codecs/codec_speex.c
dnsmgr.c
frame.c
funcs/func_math.c
funcs/func_strings.c
indications.c
manager.c
muted.c
pbx.c
pbx/dundi-parser.c
pbx/pbx_config.c
pbx/pbx_dundi.c
pbx/pbx_loopback.c
pbx/pbx_spool.c
res/res_agi.c
res/res_features.c
res/res_osp.c
utils/frame.c

index b6c013c42ec2517c054400f78386e092d9020309..0413ee64bebfc49501f2de1c7d5a551318718569 100644 (file)
--- 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 bef6ea7cce4699aed123ca85ee53bb7825895231..9665f35e883cef8315680b7d06762a7984e3b6b4 100644 (file)
--- 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;
index 79fe30122a6bff170733317e74c27f92a631cb2e..98398f06c6babfb9716bb13485df44ec61bd8bb9 100644 (file)
@@ -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 */
index 6ef78f5eb0042b4f35013a25ccba44ed8d4dd00d..3c3812152d5358698fbce456a40dc80bdef4fa9c 100644 (file)
@@ -134,7 +134,7 @@ static void database_increment( char *key )
                return;
        }
        
-       sscanf(value, "%u", &v);
+       sscanf(value, "%30u", &v);
        v++;
        
        if(option_verbose >= 4)
index 0d594996fcf9ca21a2956cdd7075299971c184b3..c70b113a982f0117e6d82bfe3e1d7990f706bec0 100644 (file)
@@ -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;
index a9740577543612d050f63f19d8a56a5fd63e4de0..b1545d90ff1b9341f4b5c5cb1df876f0da0c326f 100644 (file)
@@ -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 {
index 834b7dc475bdc8a4e89b4d821de81762a1430c31..6b78720e9ecd6f7da59049fb24d4892b38e352e2 100644 (file)
@@ -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;
index 2ac124525a85e254aaa7d4069c2af813ccdc05e8..159129100e0fc6949eadd6e766204f6b30cce704 100644 (file)
@@ -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))
index 496f62b8fc932931e507aa58113bf8d984bc6ee5..b340d823c19be21493562cf676d5898789ada6ec 100644 (file)
@@ -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");
index 557155c71138e5dbdaf9aba8f49c2ffa8266f1ca..249b56a02c6b51dc33da39c32c544db0d5bebc98 100644 (file)
@@ -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;
                                        }
index f52385c02af39d1ec3f5b19bc8cff9ef6ce7c736..adccf85bbbfff80429a83ed758da60e2e03fedb8 100644 (file)
@@ -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;
index 405dff9aaa49b98bcee69354fa914c2560589d5a..005a6c6daaadf59720b2a5b9eb5a5619921eacf1 100644 (file)
@@ -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)) {
index 9f3e2e32e122ab67dfbc0db6e93551517379b705..d487cfe25770d6092688e117e5be638170fe0f57 100644 (file)
@@ -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);
index f436d7cfa89fe989c16855e7f82301dc0788b65c..5b45141b367fa2856fe1fcf5e2e287014600d416 100644 (file)
@@ -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");
index 09b1c1556cef7822898528d2855ae3dd3caf3418..6196cd5c948601d2917f03499c072049984f6a1e 100644 (file)
@@ -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");
index a9775328b12484133028c282d1252bf4f9d6913a..1bf2416038c8289598fba249283af47b3f2bf38f 100644 (file)
@@ -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;
index 789e04beb4d9c9f1937980db7ba3d498944d6069..caf3284870950b49511e9efd04382ae610cfa26e 100644 (file)
@@ -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) {
index bc418aaa17956b3b478af94c337cb1566f0b4806..b97cd826fcb39c735c3ec31bc1526aa96c7489e8 100644 (file)
@@ -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;
                }
index 6d1dfcf21432ad66ea1338ae50f51dd8b1710df0..78e74b01f79a33c76e3a3ed426f724db7da44d97 100644 (file)
@@ -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))
index fc9cd25bf51a00d74fca0972bea6a67f764cb9b5..7dee44ea8f80cf5d8440119fca57ddda35f9a63e 100644 (file)
@@ -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;
                                }
                        }
index 3a7677601f891bb26f5c9a8e0eca8aca2e35903a..28293baff9bf8262db92225c1dcc15ed62c374d8 100644 (file)
@@ -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;
index 11efe7068988d7017640488426898d2155baa8c5..3932a4b44287ce5473132682d134df3082248e10 100644 (file)
@@ -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;
                        }
                }
index 61c60abeda70f38902040136d8af24ac6a01884e..4c0601d9aa82b98f9defbe9729cb01e794ad8841 100644 (file)
@@ -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);
                                }
index 5b31f41e606d0e06c0ad68674f3ee5ed3fa69574..a5b0dafa0bfbefb9d1aafa1804d90037d70458ac 100644 (file)
@@ -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");
index 25e651d9eb0b8a2a1a3729bebdeb9acc6522057f..97e06877fad0814bee7d07f96d1dc46999ec1314 100644 (file)
@@ -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;
        }
index 64839f352eabde0e2ffe710be55ec197ce304b80..5f3067a3307a8b52887015532f3063d93cc9939c 100644 (file)
@@ -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");
        }
 
index 9fea023edc55420a5cef905e6e9b1d71a0ce3337..416cbce736caab0786d5ba7fbd2010b18f391120 100644 (file)
@@ -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) {
index c7acd01280a38800878e5428e2e4de05b332e273..8114f664a80ac94bb0767ef5d303c0d38b5b6041 100644 (file)
@@ -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 01385d85ebada471633795d20f12c9a7d607849e..462e07b9b84ff5b68bedb5fa3e2127ca846449a4 100644 (file)
--- 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);
index 5f8a9f99d73b1bed51173ed087d1afaa247b445c..8329bb1f45ab7ba0196993538f63d2fa1030c216 100644 (file)
--- 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 {
index 53d7d10676eb7e17e06df064b5176f1958e69989..87b49839aabb9763e05f458da087a7f100380958 100644 (file)
@@ -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 {
index b2d4d8184fde79c4e445b70190ffb493a5fe2a46..082e5de460b1e535f351b2174016b2c8b4fb41f8 100644 (file)
@@ -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;
index dcae68853aab497c7e6ab13c498a2bf2ae7d8a77..daaa51a77eda8774313fa46057e7b4cb41a47011 100644 (file)
@@ -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
index de2d6a4008899a78abc6eb380e9e73f03835092d..482e868eb5300e7518afb4c7765da51ac059bb61 100644 (file)
@@ -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);
index cf5ea13f6e0235a012dd92aca30736ad4ab6dfc0..8e4e8f9acc773475ae50ffbe90409b5cfb0cd300 100644 (file)
@@ -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;
                }
index d95d175bb90be1008a45ddbe56ab6152474fdc34..a5d11c4a640099191071efe70eccae4d4af70ada 100644 (file)
@@ -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 {
index 54cadc2081c5ee65f1f3c98ba82b2e676263cba1..1b9ac8309e458337b9b44d9e321abbbd47b4bb69 100644 (file)
@@ -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);
index d13e453c0ed711dc1352ad65d59a68eaa2183bd1..5ad323b7b3bc019aa2167a91e2e629c726c27804 100644 (file)
@@ -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;
index c9d3f885487781d60a3e6d81ec2e9d71e3f4c29b..2c0d8d226c64c7c20c2f7a5cece8996f27111ee7 100644 (file)
@@ -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);
index 0b067124b95a9fc41e8617c8fa7f45c761593467..6305034dc3964bc25bce3db554a951873fb870f8 100644 (file)
@@ -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;
index 8589de4323be8a8448e164d74b5a4f67423f3001..36b06529ed486355b2c4044b6e62e29b790224e3 100644 (file)
@@ -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) {
index b7ef989d39d8774979d8ce5d1c2dbd5b646cf1d8..c05aa0160d224d9d52fe3c137287f859deb02351 100644 (file)
@@ -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;
index b2c4289fd1358b8319204d98280a130ce03bdbda..5324af63fd46bc9d450ca4144e34b4f31ef95760 100644 (file)
@@ -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 4a96624eef9b0e39880dfa96fcc06f2ce3406fdd..7e71ce2bf226ba0fcc4d144d0a52efd6225f272e 100644 (file)
--- 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) {
index 24a6704a9772a43071632529dd64594f15b7c3ef..7400c4ad07d860144dc291e7da0d9409f16f2a66 100644 (file)
@@ -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);
index 75fcdd830051f097bb66caa5904058862f1a40c0..587e0ab39fd374970bfd2d5b51ac51ee8818e982 100644 (file)
--- 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 ddb61d6fbb8563f23c422a0ba8fc8adac205f73d..a27d4161d1b89aee2d85bded688a6a8701f899e5 100644 (file)
--- 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++)
index 4795efcc626db4e26d9de69e3154a9eca6af94fb..e456d1af688468182b81887e129de83d34611cbe 100644 (file)
@@ -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;
        }
index 0aaf3fc4b0c53cf7624a596370d3d821fa031eef..9ce8b08d22b90c81726bfa79ec0008b43c676834 100644 (file)
@@ -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;
        }
index e9ca85d9cdc3955d4872b4a9d217e07d52fe25ee..e18ca146bf2b7a3d0c567a2531ac777140040014 100644 (file)
@@ -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;
index bddd2bc6a09f9505f5c5ba2482453b4619452cc4..d3bf566808bde541d11bdd576813a0713a487051 100644 (file)
--- 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 600892cad6a5eb98e49e2370d62238a1d40bb227..9ce7326ae37abe71ddb6bb77bbb9fa4f2054fbc1 100644 (file)
--- 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 2b2edc211043350194349df3df8e8f372db8879e..bded9354911c676b62996b00c8ca9ff9f1309f11 100644 (file)
--- 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);
index 9b9d9d205ffc1d7e3339f26c5f82b5b1f7a8bd63..9ff70f9526397b7defa71750895af05bb6a46644 100644 (file)
@@ -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++)
index 5e850a2bf91d5ec4697a49874f0adedbdb62678b..5151ea0e300407045c12d3e4e06a7aeb0338f470 100644 (file)
@@ -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;
index 8b87c8ec92d18d828ff0e153ee086991fb3b4674..15792e3c6a258824fd7fba62a3751247153aed05 100644 (file)
@@ -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",
index 5522e9b0922614cb32fff48c8b30124bccb3b7c6..ec719950602a1b09aabb50dc04838c9da0690bf2 100644 (file)
@@ -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)
index 1141b85a15ffeb690df4d0fa046921b7bf2dfdde..15e0222a810e97dbc0cf38ce51f436fe12b2dda8 100644 (file)
@@ -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;
                                        }
index 53cafd58c3ec24fddc07cd6fc5f4cb03ca2f07ee..85a701ee04f7f0f65b191a01e1935d29a401e033 100644 (file)
@@ -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:
index 756733fc1283016bc5bd9f93f2d7080da8a5e9af..0add7bab9a28f4ebfa3337ba41adba7a4bca364c 100644 (file)
@@ -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;
                                }
index 41ca8c0cf0f28a94cb4ac925bdabcafe099d3fcc..f2aa60a0f7ee3ae75b8489d3c3762cc2e022841b 100644 (file)
@@ -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);
                        }
index 7fdb1637db650325a3fae79d62e8388e1226345c..05f54d162e01dfaf0a1169574c805f249fa9a600 100644 (file)
@@ -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: