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

69 files changed:
agi/eagi-sphinx-test.c
agi/eagi-test.c
apps/app_adsiprog.c
apps/app_alarmreceiver.c
apps/app_chanspy.c
apps/app_dahdibarge.c
apps/app_dial.c
apps/app_disa.c
apps/app_followme.c
apps/app_macro.c
apps/app_meetme.c
apps/app_mixmonitor.c
apps/app_morsecode.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_rpt.c
apps/app_setcallerid.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
channels/chan_agent.c
channels/chan_dahdi.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/iax2-provision.c
channels/misdn_config.c
codecs/codec_speex.c
doc/CODING-GUIDELINES
funcs/func_channel.c
funcs/func_cut.c
funcs/func_math.c
funcs/func_rand.c
funcs/func_strings.c
main/acl.c
main/asterisk.c
main/cdr.c
main/channel.c
main/cli.c
main/dnsmgr.c
main/frame.c
main/indications.c
main/manager.c
main/pbx.c
main/utils.c
pbx/dundi-parser.c
pbx/pbx_ael.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_odbc.c
res/res_smdi.c
utils/frame.c
utils/muted.c

index 968e3cfc3921b3b31186d4f904918a7ad27a678a..f3f3abfe9b1682fbabc59960d59af400ed2f7b1c 100644 (file)
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
        connect_sphinx();
        tmp = getenv("agi_enhanced");
        if (tmp) {
-               if (sscanf(tmp, "%d.%d", &ver, &subver) != 2)
+               if (sscanf(tmp, "%30d.%30d", &ver, &subver) != 2)
                        ver = 0;
        }
        if (ver < 1) {
index 9bfbee79ec6cbb53b1613276d389abdab2432799..a768d7fb840453651a1e3f656c5800d5d6dbd572 100644 (file)
@@ -156,7 +156,7 @@ int main(int argc, char *argv[])
        }
        tmp = getenv("agi_enhanced");
        if (tmp) {
-               if (sscanf(tmp, "%d.%d", &ver, &subver) != 2)
+               if (sscanf(tmp, "%30d.%30d", &ver, &subver) != 2)
                        ver = 0;
        }
        if (ver < 1) {
index 750cc6fc7a268c47956d363735f3a9f21d3f50a8..14de26ce875b7444e54270d458f8c3998ec67c98 100644 (file)
@@ -195,7 +195,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 */
@@ -205,7 +205,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 */
@@ -215,7 +215,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 8afce25d577b80c515b7a0a8a730d405b8e9253d..7bf98e8750735a86796a516d424d6ce252eb3eba 100644 (file)
@@ -125,7 +125,7 @@ static void database_increment( char *key )
                return;
        }
        
-       sscanf(value, "%u", &v);
+       sscanf(value, "%30u", &v);
        v++;
        
        if(option_verbose >= 4)
index 91b28137f5958064ae317b69af8f099069e3676c..45a90ff6dc2ae9bd24b3087d8c2138d08e680a2e 100644 (file)
@@ -735,7 +735,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;
@@ -820,7 +820,7 @@ static int extenspy_exec(struct ast_channel *chan, void *data)
                if (ast_test_flag(&flags, OPTION_VOLUME) && opts[OPT_ARG_VOLUME]) {
                        int vol;
 
-                       if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
+                       if ((sscanf(opts[OPT_ARG_VOLUME], "%30d", &vol) != 1) || (vol > 4) || (vol < -4))
                                ast_log(LOG_NOTICE, "Volume factor must be a number between -4 and 4\n");
                        else
                                volfactor = vol;
index cba85a9b64a4764b704df53e8ff1a32316f5cc1d..e2255185c18aaea00ab3ad88bc01375daceff3c1 100644 (file)
@@ -277,15 +277,15 @@ static int exec(struct ast_channel *chan, void *data, int dahdimode)
        
        if (!ast_strlen_zero(data)) {
                if (dahdimode) {
-                       if ((sscanf(data, "DAHDI/%d", &confno) != 1) &&
-                           (sscanf(data, "%d", &confno) != 1)) {
+                       if ((sscanf(data, "DAHDI/%30d", &confno) != 1) &&
+                           (sscanf(data, "%30d", &confno) != 1)) {
                                ast_log(LOG_WARNING, "Argument (if specified) must be a channel number, not '%s'\n", (char *) data);
                                ast_module_user_remove(u);
                                return 0;
                        }
                } else {
-                       if ((sscanf(data, "Zap/%d", &confno) != 1) &&
-                           (sscanf(data, "%d", &confno) != 1)) {
+                       if ((sscanf(data, "Zap/%30d", &confno) != 1) &&
+                           (sscanf(data, "%30d", &confno) != 1)) {
                                ast_log(LOG_WARNING, "Argument (if specified) must be a channel number, not '%s'\n", (char *) data);
                                ast_module_user_remove(u);
                                return 0;
@@ -301,7 +301,7 @@ static int exec(struct ast_channel *chan, void *data, int dahdimode)
                confstr[0] = '\0';
                res = ast_app_getdata(chan, "conf-getchannel",confstr, sizeof(confstr) - 1, 0);
                if (res <0) goto out;
-               if (sscanf(confstr, "%d", &confno) != 1)
+               if (sscanf(confstr, "%30d", &confno) != 1)
                        confno = 0;
        }
        if (confno) {
index 080de00fecd3d43b5c23d15c6965344654f8d83a..95a2e244034df212d0a746cda52af359c88a0f4f 100644 (file)
@@ -1863,7 +1863,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
 
        if ((dialdata = strchr(announce, '|'))) {
                *dialdata++ = '\0';
-               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);
@@ -1871,7 +1871,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
                }
                if ((dialdata = strchr(dialdata, '|'))) {
                        *dialdata++ = '\0';
-                       if (sscanf(dialdata, "%d", &loops) != 1) {
+                       if (sscanf(dialdata, "%30d", &loops) != 1) {
                                ast_log(LOG_ERROR, "%s requires the numerical argument <loops>\n",rapp);
                                goto done;
                        }
index f49d19704c119f60ea19513fada209c8aa9f050e..3c8bad9d4a7130b4dadc20db8a1e957e67f599e9 100644 (file)
@@ -240,7 +240,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
                        if (!(k&1)) { /* if in password state */
                                if (j == '#') { /* end of password */
                                          /* see if this is an integer */
-                                       if (sscanf(args.passcode,"%d",&j) < 1) { /* nope, it must be a filename */
+                                       if (sscanf(args.passcode,"%30d",&j) < 1) { /* nope, it must be a filename */
                                                fp = fopen(args.passcode,"r");
                                                if (!fp) {
                                                        ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,chan->name);
@@ -266,7 +266,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)
+                                                       if (sscanf(args.passcode,"%30d", &j) < 1)
                                                                continue;
                                                         /* if we got it */
                                                        if (!strcmp(exten,args.passcode)) {
index ecf178fddc82d116df03d37f8f86c26d521e948f..73e991135e011d18253b86f98cf909301343b27c 100644 (file)
@@ -315,7 +315,7 @@ static int reload_followme(void)
        featuredigittostr = ast_variable_retrieve(cfg, "general", "featuredigittimeout");
        
        if (!ast_strlen_zero(featuredigittostr)) {
-               if (!sscanf(featuredigittostr, "%d", &featuredigittimeout))
+               if (!sscanf(featuredigittostr, "%30d", &featuredigittimeout))
                        featuredigittimeout = 5000;
        }
 
index af042913a8170df78a8ebe4280379ddd583d96c3..5586f24e51547b8edde58a746e7581625cdb4b67 100644 (file)
@@ -220,18 +220,18 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
        /* does the user want a deeper rabbit hole? */
        s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
        if (s)
-               sscanf(s, "%d", &maxdepth);
+               sscanf(s, "%30d", &maxdepth);
 
        /* Count how many levels deep the rabbit hole goes */
        s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
        if (s)
-               sscanf(s, "%d", &depth);
+               sscanf(s, "%30d", &depth);
        /* Used for detecting whether to return when a Macro is called from another Macro after hangup */
        if (strcmp(chan->exten, "h") == 0)
                pbx_builtin_setvar_helper(chan, "MACRO_IN_HANGUP", "1");
        inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP");
        if (!ast_strlen_zero(inhangupc))
-               sscanf(inhangupc, "%d", &inhangup);
+               sscanf(inhangupc, "%30d", &inhangup);
 
        if (depth >= maxdepth) {
                ast_log(LOG_ERROR, "Macro():  possible infinite loop detected.  Returning early.\n");
@@ -511,7 +511,7 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
                        if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) {
                                /* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
                                normally if there is any problem */
-                               if (sscanf(offsets, "%d", &offset) == 1) {
+                               if (sscanf(offsets, "%30d", &offset) == 1) {
                                        if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->cid.cid_num)) {
                                                chan->priority += offset;
                                        }
index 9e6af1865d0e177f52375039f6c99d9a75b7dc25..0e82f33f27972ef7e8e8806d9e4d04b5adb21c05 100644 (file)
@@ -835,7 +835,7 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
        AST_LIST_INSERT_HEAD(&confs, cnf, list);
 
        /* Reserve conference number in map */
-       if ((sscanf(cnf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
+       if ((sscanf(cnf->confno, "%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
                conf_map[confno_int] = 1;
        
 cnfout:
@@ -1403,7 +1403,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;
@@ -1537,7 +1537,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;
        }
@@ -2794,7 +2794,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, "");
@@ -2917,7 +2917,7 @@ static struct ast_conf_user *find_user(struct ast_conference *conf, char *caller
        struct ast_conf_user *user = NULL;
        int cid;
        
-       sscanf(callerident, "%i", &cid);
+       sscanf(callerident, "%30i", &cid);
        if (conf && callerident) {
                AST_LIST_TRAVERSE(&conf->userlist, user, list) {
                        if (cid == user->user_no)
@@ -3251,7 +3251,7 @@ static void load_config_meetme(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 < DAHDI_DEFAULT_NUM_BUFS) || (audio_buffers > DAHDI_MAX_NUM_BUFS)) {
@@ -4707,7 +4707,7 @@ static int sla_build_trunk(struct ast_config *cfg, const char *cat)
                if (!strcasecmp(var->name, "autocontext"))
                        ast_string_field_set(trunk, autocontext, var->value);
                else if (!strcasecmp(var->name, "ringtimeout")) {
-                       if (sscanf(var->value, "%u", &trunk->ring_timeout) != 1) {
+                       if (sscanf(var->value, "%30u", &trunk->ring_timeout) != 1) {
                                ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for trunk '%s'\n",
                                        var->value, trunk->name);
                                trunk->ring_timeout = 0;
@@ -4783,13 +4783,13 @@ static void sla_add_trunk_to_station(struct sla_station *station, struct ast_var
                char *name, *value = cur;
                name = strsep(&value, "=");
                if (!strcasecmp(name, "ringtimeout")) {
-                       if (sscanf(value, "%u", &trunk_ref->ring_timeout) != 1) {
+                       if (sscanf(value, "%30u", &trunk_ref->ring_timeout) != 1) {
                                ast_log(LOG_WARNING, "Invalid ringtimeout value '%s' for "
                                        "trunk '%s' on station '%s'\n", value, trunk->name, station->name);
                                trunk_ref->ring_timeout = 0;
                        }
                } else if (!strcasecmp(name, "ringdelay")) {
-                       if (sscanf(value, "%u", &trunk_ref->ring_delay) != 1) {
+                       if (sscanf(value, "%30u", &trunk_ref->ring_delay) != 1) {
                                ast_log(LOG_WARNING, "Invalid ringdelay value '%s' for "
                                        "trunk '%s' on station '%s'\n", value, trunk->name, station->name);
                                trunk_ref->ring_delay = 0;
@@ -4838,13 +4838,13 @@ static int sla_build_station(struct ast_config *cfg, const char *cat)
                else if (!strcasecmp(var->name, "autocontext"))
                        ast_string_field_set(station, autocontext, var->value);
                else if (!strcasecmp(var->name, "ringtimeout")) {
-                       if (sscanf(var->value, "%u", &station->ring_timeout) != 1) {
+                       if (sscanf(var->value, "%30u", &station->ring_timeout) != 1) {
                                ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for station '%s'\n",
                                        var->value, station->name);
                                station->ring_timeout = 0;
                        }
                } else if (!strcasecmp(var->name, "ringdelay")) {
-                       if (sscanf(var->value, "%u", &station->ring_delay) != 1) {
+                       if (sscanf(var->value, "%30u", &station->ring_delay) != 1) {
                                ast_log(LOG_WARNING, "Invalid ringdelay '%s' specified for station '%s'\n",
                                        var->value, station->name);
                                station->ring_delay = 0;
index 8d86db74069a83cd0de7ed136e837c161b0653ca..3f784f7309e1cfbbf39d09cc1d45e7ce7e205935 100644 (file)
@@ -451,7 +451,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);
@@ -461,7 +461,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);
@@ -471,7 +471,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 aec946a098912c4facbb3ad6aa47f655534fea63..8be4861b01f2282dece808668f315eeaba6a7ef9 100644 (file)
@@ -123,13 +123,13 @@ static int morsecode_exec(struct ast_channel *chan, void *data)
 
        /* Use variable MORESEDITLEN, if set (else 80) */
        ditlenc = pbx_builtin_getvar_helper(chan, "MORSEDITLEN");
-       if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%d", &ditlen) != 1)) {
+       if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%30d", &ditlen) != 1)) {
                ditlen = 80;
        }
 
        /* Use variable MORSETONE, if set (else 800) */
        tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
-       if (ast_strlen_zero(tonec) || (sscanf(tonec, "%d", &tone) != 1)) {
+       if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
                tone = 800;
        }
 
index ad2ce506528064f60b72c2031349a74c2f223596..6cd0352991464136611911f73d84782777eb3d3e 100644 (file)
@@ -208,7 +208,7 @@ static int osp_create_provider(struct ast_config* cfg, const char* provider)
                                ast_log(LOG_WARNING, "OSP: Too many Service Points at line %d\n", v->lineno);
                        }
                } else if (!strcasecmp(v->name, "maxconnections")) {
-                       if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_MAXCONNECTIONS) && (t <= OSP_MAX_MAXCONNECTIONS)) {
+                       if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_MAXCONNECTIONS) && (t <= OSP_MAX_MAXCONNECTIONS)) {
                                p->maxconnections = t;
                                ast_log(LOG_DEBUG, "OSP: maxconnections '%d'\n", t);
                        } else {
@@ -216,7 +216,7 @@ static int osp_create_provider(struct ast_config* cfg, const char* provider)
                                        OSP_MIN_MAXCONNECTIONS, OSP_MAX_MAXCONNECTIONS, v->value, v->lineno);
                        }
                } else if (!strcasecmp(v->name, "retrydelay")) {
-                       if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_RETRYDELAY) && (t <= OSP_MAX_RETRYDELAY)) {
+                       if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_RETRYDELAY) && (t <= OSP_MAX_RETRYDELAY)) {
                                p->retrydelay = t;
                                ast_log(LOG_DEBUG, "OSP: retrydelay '%d'\n", t);
                        } else {
@@ -224,7 +224,7 @@ static int osp_create_provider(struct ast_config* cfg, const char* provider)
                                        OSP_MIN_RETRYDELAY, OSP_MAX_RETRYDELAY, v->value, v->lineno);
                        }
                } else if (!strcasecmp(v->name, "retrylimit")) {
-                       if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_RETRYLIMIT) && (t <= OSP_MAX_RETRYLIMIT)) {
+                       if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_RETRYLIMIT) && (t <= OSP_MAX_RETRYLIMIT)) {
                                p->retrylimit = t;
                                ast_log(LOG_DEBUG, "OSP: retrylimit '%d'\n", t);
                        } else {
@@ -232,7 +232,7 @@ static int osp_create_provider(struct ast_config* cfg, const char* provider)
                                        OSP_MIN_RETRYLIMIT, OSP_MAX_RETRYLIMIT, v->value, v->lineno);
                        }
                } else if (!strcasecmp(v->name, "timeout")) {
-                       if ((sscanf(v->value, "%d", &t) == 1) && (t >= OSP_MIN_TIMEOUT) && (t <= OSP_MAX_TIMEOUT)) {
+                       if ((sscanf(v->value, "%30d", &t) == 1) && (t >= OSP_MIN_TIMEOUT) && (t <= OSP_MAX_TIMEOUT)) {
                                p->timeout = t;
                                ast_log(LOG_DEBUG, "OSP: timeout '%d'\n", t);
                        } else {
@@ -243,7 +243,7 @@ static int osp_create_provider(struct ast_config* cfg, const char* provider)
                        ast_copy_string(p->source, v->value, sizeof(p->source));
                        ast_log(LOG_DEBUG, "OSP: source '%s'\n", p->source);
                } else if (!strcasecmp(v->name, "authpolicy")) {
-                       if ((sscanf(v->value, "%d", &t) == 1) && ((t == OSP_AUTH_NO) || (t == OSP_AUTH_YES) || (t == OSP_AUTH_EXCLUSIVE))) {
+                       if ((sscanf(v->value, "%30d", &t) == 1) && ((t == OSP_AUTH_NO) || (t == OSP_AUTH_YES) || (t == OSP_AUTH_EXCLUSIVE))) {
                                p->authpolicy = t;
                                ast_log(LOG_DEBUG, "OSP: authpolicy '%d'\n", t);
                        } else {
@@ -1051,11 +1051,11 @@ static int osplookup_exec(struct ast_channel* chan, void* data)
        headp = &chan->varshead;
        AST_LIST_TRAVERSE(headp, current, entries) {
                if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
-                       if (sscanf(ast_var_value(current), "%d", &result.inhandle) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &result.inhandle) != 1) {
                                result.inhandle = OSP_INVALID_HANDLE;
                        }
                } else if (!strcasecmp(ast_var_name(current), "OSPINTIMELIMIT")) {
-                       if (sscanf(ast_var_value(current), "%d", &result.intimelimit) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &result.intimelimit) != 1) {
                                result.intimelimit = OSP_DEF_TIMELIMIT;
                        }
                } else if (!strcasecmp(ast_var_name(current), "OSPPEERIP")) {
@@ -1177,7 +1177,7 @@ static int ospnext_exec(struct ast_channel* chan, void* data)
 
        AST_STANDARD_APP_ARGS(args, tmp);
 
-       if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%d", &cause) != 1) {
+       if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%30d", &cause) != 1) {
                cause = 0;
        }
        ast_log(LOG_DEBUG, "OSPNext: cause '%d'\n", cause);
@@ -1195,19 +1195,19 @@ static int ospnext_exec(struct ast_channel* chan, void* data)
        headp = &chan->varshead;
        AST_LIST_TRAVERSE(headp, current, entries) {
                if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
-                       if (sscanf(ast_var_value(current), "%d", &result.inhandle) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &result.inhandle) != 1) {
                                result.inhandle = OSP_INVALID_HANDLE;
                        }
                } else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
-                       if (sscanf(ast_var_value(current), "%d", &result.outhandle) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &result.outhandle) != 1) {
                                result.outhandle = OSP_INVALID_HANDLE;
                        }
                } else if (!strcasecmp(ast_var_name(current), "OSPINTIMELIMIT")) {
-                       if (sscanf(ast_var_value(current), "%d", &result.intimelimit) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &result.intimelimit) != 1) {
                                result.intimelimit = OSP_DEF_TIMELIMIT;
                        }
                } else if (!strcasecmp(ast_var_name(current), "OSPRESULTS")) {
-                       if (sscanf(ast_var_value(current), "%d", &result.numresults) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &result.numresults) != 1) {
                                result.numresults = 0;
                        }
                }
@@ -1322,11 +1322,11 @@ static int ospfinished_exec(struct ast_channel* chan, void* data)
        headp = &chan->varshead;
        AST_LIST_TRAVERSE(headp, current, entries) {
                if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
-                       if (sscanf(ast_var_value(current), "%d", &inhandle) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &inhandle) != 1) {
                                inhandle = OSP_INVALID_HANDLE;
                        }
                } else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
-                       if (sscanf(ast_var_value(current), "%d", &outhandle) != 1) {
+                       if (sscanf(ast_var_value(current), "%30d", &outhandle) != 1) {
                                outhandle = OSP_INVALID_HANDLE;
                        }
                } else if (!recorded &&
@@ -1343,7 +1343,7 @@ static int ospfinished_exec(struct ast_channel* chan, void* data)
        ast_log(LOG_DEBUG, "OSPFinish: OSPOUTHANDLE '%d'\n", outhandle);
        ast_log(LOG_DEBUG, "OSPFinish: recorded '%d'\n", recorded);
 
-       if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%d", &cause) != 1) {
+       if (!ast_strlen_zero(args.cause) && sscanf(args.cause, "%30d", &cause) != 1) {
                cause = 0;
        }
        ast_log(LOG_DEBUG, "OSPFinish: cause '%d'\n", cause);
@@ -1435,7 +1435,7 @@ static int osp_load(void)
 
                t = ast_variable_retrieve(cfg, OSP_GENERAL_CAT, "tokenformat");
                if (t) {
-                       if ((sscanf(t, "%d", &v) == 1) && 
+                       if ((sscanf(t, "%30d", &v) == 1) && 
                                ((v == TOKEN_ALGO_SIGNED) || (v == TOKEN_ALGO_UNSIGNED) || (v == TOKEN_ALGO_BOTH))) 
                        {
                                osp_tokenformat = v;
index 5da93eb401a19589475ca2a7fe4f54ae05b97f40..65bd625d768cc43676ad4c4af72a1e4df6cb4a29 100644 (file)
@@ -115,13 +115,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");
@@ -138,14 +138,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 4d2eb62048abba99fa032559b761ca8393e0c0b9..63cb4b082e20db146ea9000da37b08b946ec4325 100644 (file)
@@ -3822,7 +3822,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;
                }
@@ -3961,7 +3961,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);
@@ -3978,7 +3978,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
 
        /* Get the maximum penalty from the variable ${QUEUE_MAX_PENALTY} */
        if ((max_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MAX_PENALTY"))) {
-               if (sscanf(max_penalty_str, "%d", &max_penalty) == 1) {
+               if (sscanf(max_penalty_str, "%30d", &max_penalty) == 1) {
                        if (option_debug)
                                ast_log(LOG_DEBUG, "%s: Got max penalty %d from ${QUEUE_MAX_PENALTY}.\n",
                                        chan->name, max_penalty);
@@ -4865,7 +4865,7 @@ static int manager_add_queue_member(struct mansession *s, const struct message *
 
        if (ast_strlen_zero(penalty_s))
                penalty = 0;
-       else if (sscanf(penalty_s, "%d", &penalty) != 1 || penalty < 0)
+       else if (sscanf(penalty_s, "%30d", &penalty) != 1 || penalty < 0)
                penalty = 0;
 
        if (ast_strlen_zero(paused_s))
@@ -4969,7 +4969,7 @@ static int handle_queue_add_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 8484f656d8295d72d082b4c20cc4f2851465691d..0d036413d0901c10aa7beda35a3c8805b5ad92ff 100644 (file)
@@ -71,7 +71,7 @@ static int random_exec(struct ast_channel *chan, void *data)
        s = ast_strdupa(data);
 
        prob = strsep(&s,":");
-       if ((!prob) || (sscanf(prob, "%d", &probint) != 1))
+       if ((!prob) || (sscanf(prob, "%30d", &probint) != 1))
                probint = 0;
 
        if (!deprecated) {
index 7e43a38064c89fc4059d9a771133547dd003580e..113a639cfecc49cc0aff2d2ca849454cd666a2a4 100644 (file)
@@ -80,7 +80,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 23e1a9a85fa1935b3d1a85f6d2c6cb3db578795b..075fd7c28ea6fcf6e63eda197182c2646ae35c2c 100644 (file)
@@ -140,7 +140,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);
@@ -148,7 +148,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 dd4cd3a7d09457231a85ddb966ef478a0c07491c..2f4af8ca90e0518d09b389cbc722c49379ea38b7 100644 (file)
@@ -1522,7 +1522,7 @@ int       ret;
 
        if (str == NULL) return -1;
        /* leave this %i alone, non-base-10 input is useful here */
-       if (sscanf(str,"%i",&ret) != 1) return -1;
+       if (sscanf(str,"%30i",&ret) != 1) return -1;
        return ret;
 }
 
@@ -1697,7 +1697,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis
        /* do not use atoi() here, we need to be able to have
                the input specified in hex or decimal so we use
                sscanf with a %i */
-       if ((!val) || (sscanf(val,"%i",&rpt_vars[n].p.iobase) != 1))
+       if ((!val) || (sscanf(val,"%30i",&rpt_vars[n].p.iobase) != 1))
        rpt_vars[n].p.iobase = DEFAULT_IOBASE;
        val = (char *) ast_variable_retrieve(cfg,this,"ioport");
        rpt_vars[n].p.ioport = val;
@@ -2641,7 +2641,7 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring)
                tonesubset = strsep(&stringp,")");
                if(!tonesubset)
                        break;
-               if(sscanf(tonesubset,"(%d,%d,%d,%d", &f1, &f2, &duration, &amplitude) != 4)
+               if(sscanf(tonesubset,"(%30d,%30d,%30d,%30d", &f1, &f2, &duration, &amplitude) != 4)
                        break;
                res = play_tone_pair(chan, f1, f2, duration, amplitude);
                if(res)
@@ -3983,7 +3983,7 @@ struct dahdi_params par;
                p = strstr(tdesc, "version");   
                if(!p)
                        break;  
-               if(sscanf(p, "version %d.%d", &vmajor, &vminor) != 2)
+               if(sscanf(p, "version %30d.%30d", &vmajor, &vminor) != 2)
                        break;
                wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
                /* Say "version" */
@@ -5303,6 +5303,8 @@ static int collect_function_digits(struct rpt *myrpt, char *digits,
 static void handle_link_data(struct rpt *myrpt, struct rpt_link *mylink,
        char *str)
 {
+/* XXX ATTENTION: if you change the size of these arrays you MUST
+ * change the limits in corresponding sscanf() calls below. */
 char   tmp[512],cmd[300] = "",dest[300],src[300],c;
 int    seq, res;
 struct rpt_link *l;
@@ -5336,7 +5338,9 @@ struct    ast_frame wf;
        }
        if (tmp[0] == 'I')
        {
-               if (sscanf(tmp,"%s %s %x",cmd,src,&seq) != 3)
+               /* XXX WARNING: be very careful with the limits on the folowing
+                * sscanf() call, make sure they match the values defined above */
+               if (sscanf(tmp,"%299s %299s %30x",cmd,src,&seq) != 3)
                {
                        ast_log(LOG_WARNING, "Unable to parse ident string %s\n",str);
                        return;
@@ -5346,7 +5350,9 @@ struct    ast_frame wf;
        }
        else
        {
-               if (sscanf(tmp,"%s %s %s %d %c",cmd,dest,src,&seq,&c) != 5)
+               /* XXX WARNING: be very careful with the limits on the folowing
+                * sscanf() call, make sure they match the values defined above */
+               if (sscanf(tmp,"%299s %299s %299s %30d %1c",cmd,dest,src,&seq,&c) != 5)
                {
                        ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
                        return;
@@ -8332,6 +8338,8 @@ int       ret,res = 0,src;
 
 static int handle_remote_data(struct rpt *myrpt, char *str)
 {
+/* XXX ATTENTION: if you change the size of these arrays you MUST
+ * change the limits in corresponding sscanf() calls below. */
 char   tmp[300],cmd[300],dest[300],src[300],c;
 int    seq,res;
 
@@ -8342,7 +8350,9 @@ int       seq,res;
 #ifndef        DO_NOT_NOTIFY_MDC1200_ON_REMOTE_BASES
        if (tmp[0] == 'I')
        {
-               if (sscanf(tmp,"%s %s %x",cmd,src,&seq) != 3)
+               /* XXX WARNING: be very careful with the limits on the folowing
+                * sscanf() call, make sure they match the values defined above */
+               if (sscanf(tmp,"%299s %299s %30x",cmd,src,&seq) != 3)
                {
                        ast_log(LOG_WARNING, "Unable to parse ident string %s\n",str);
                        return 0;
@@ -8351,7 +8361,9 @@ int       seq,res;
                return 0;
        }
 #endif
-       if (sscanf(tmp,"%s %s %s %d %c",cmd,dest,src,&seq,&c) != 5)
+       /* XXX WARNING: be very careful with the limits on the folowing
+        * sscanf() call, make sure they match the values defined above */
+       if (sscanf(tmp,"%299s %299s %299s %30d %1c",cmd,dest,src,&seq,&c) != 5)
        {
                ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
                return 0;
index fb060f11b0eff645f5912eaea0a60d42df626ab9..2877d00e140899bae1b254d89563671f1647e380 100644 (file)
@@ -72,7 +72,7 @@ static int setcallerid_pres_exec(struct ast_channel *chan, void *data)
        u = ast_module_user_add(chan);
 
        /* For interface consistency, permit the argument to be specified as a number */
-       if (sscanf(data, "%d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
+       if (sscanf(data, "%30d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
                pres = ast_parse_caller_presentation(data);
        }
 
index cd445456e22c2a4623ecd95162c86fe0c0a4576a..b1bc849881d25884000ce0532f0b6b0982a0fac0 100644 (file)
@@ -747,7 +747,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, "%30d-%30d-%30dT%30d:%30d:%30d", &Y, &m, &d, &H, &M, &S) == 6)
                                                {
                                                        struct tm t;
                                                        t.tm_year = Y - 1900;
index 79cbbd5d0e742e65e824c2400eeea6f85890236f..bf35787bb8e045c132e3ada729b1558efdde78d4 100644 (file)
@@ -89,15 +89,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 f9bcfd1161998480ac27c828b49f7865c229dca8..3bd841ad891fa5c8683ce25833f7da9eaac1de8b 100644 (file)
@@ -65,7 +65,7 @@ static int verbose_exec(struct ast_channel *chan, void *data)
                vtext = ast_strdupa(data);
                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 5625b01c85d1fae3aaba4669519e59baf550d879..2213f8855dac29f211d8395e5b0555811155b7b7 100644 (file)
@@ -647,7 +647,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");
@@ -672,7 +672,7 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
                        vmu->maxmsg = MAXMSGLIMIT;
                }
        } else if (!strcasecmp(var, "volgain")) {
-               sscanf(value, "%lf", &vmu->volgain);
+               sscanf(value, "%30lf", &vmu->volgain);
        } else if (!strcasecmp(var, "options")) {
                apply_options(vmu, value);
        }
@@ -2421,7 +2421,7 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
                        ast_odbc_release_obj(obj);
                        goto yuck;
                }
-               if (sscanf(rowdata, "%d", &x) != 1)
+               if (sscanf(rowdata, "%30d", &x) != 1)
                        ast_log(LOG_WARNING, "Failed to read message count!\n");
                SQLFreeHandle (SQL_HANDLE_STMT, stmt);
                ast_odbc_release_obj(obj);
@@ -2467,7 +2467,7 @@ static int message_exists(char *dir, int msgnum)
                        ast_odbc_release_obj(obj);
                        goto yuck;
                }
-               if (sscanf(rowdata, "%d", &x) != 1)
+               if (sscanf(rowdata, "%30d", &x) != 1)
                        ast_log(LOG_WARNING, "Failed to read message count!\n");
                SQLFreeHandle (SQL_HANDLE_STMT, stmt);
                ast_odbc_release_obj(obj);
@@ -3034,7 +3034,7 @@ static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu
                pbx_builtin_setvar_helper(ast, "ORIG_VM_CIDNUM", origcidnum);
        }
 
-       if ((origtime = ast_variable_retrieve(msg_cfg, "message", "origtime")) && sscanf(origtime, "%d", &inttime) == 1) {
+       if ((origtime = ast_variable_retrieve(msg_cfg, "message", "origtime")) && sscanf(origtime, "%30d", &inttime) == 1) {
                time_t ttime = inttime;
                struct tm tm;
                ast_localtime(&ttime, &tm, NULL);
@@ -3354,7 +3354,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
 
                                /* You might be tempted to do origdate, except that a) it's in the wrong
                                 * format, and b) it's missing for IMAP recordings. */
-                               if ((v = ast_variable_retrieve(msg_cfg, "message", "origtime")) && sscanf(v, "%d", &inttime) == 1) {
+                               if ((v = ast_variable_retrieve(msg_cfg, "message", "origtime")) && sscanf(v, "%30d", &inttime) == 1) {
                                        time_t ttime = inttime;
                                        struct tm tm;
                                        ast_localtime(&ttime, &tm, NULL);
@@ -7373,7 +7373,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
                        if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
                                int gain;
                                if (!ast_strlen_zero(opts[OPT_ARG_RECORDGAIN])) {
-                                       if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) {
+                                       if (sscanf(opts[OPT_ARG_RECORDGAIN], "%30d", &gain) != 1) {
                                                ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]);
                                                ast_module_user_remove(u);
                                                return -1;
@@ -7387,7 +7387,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
                        if (ast_test_flag(&flags, OPT_AUTOPLAY) ) {
                                play_auto = 1;
                                if (opts[OPT_ARG_PLAYFOLDER]) {
-                                       if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%d", &play_folder) != 1) {
+                                       if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%30d", &play_folder) != 1) {
                                                ast_log(LOG_WARNING, "Invalid value '%s' provided for folder autoplay option\n", opts[OPT_ARG_PLAYFOLDER]);
                                        }
                                } else {
@@ -7924,7 +7924,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]);
                                        ast_module_user_remove(u);
                                        return -1;
@@ -8345,7 +8345,7 @@ static int load_config(void)
 
                volgain = 0.0;
                if ((volgainstr = ast_variable_retrieve(cfg, "general", "volgain")))
-                       sscanf(volgainstr, "%lf", &volgain);
+                       sscanf(volgainstr, "%30lf", &volgain);
 
 #ifdef ODBC_STORAGE
                strcpy(odbc_database, "asterisk");
@@ -8499,7 +8499,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");
@@ -8508,7 +8508,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 / 1000 >= vmminmessage)
                                        ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
@@ -8523,7 +8523,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");
@@ -8531,7 +8531,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");
@@ -8540,7 +8540,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");
@@ -8629,7 +8629,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 a4f69ae7746e78622635464d062a72502985b20f..c4cea20e8842e74db3660929aebfcf41b7fb58e9 100644 (file)
@@ -60,7 +60,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 40435fb5c9e30efdd60187a1ad52cf4605533bda..d0e02e0627d5e40e084052cbcaccc572c230c54a 100644 (file)
@@ -167,9 +167,9 @@ static int waitforsilence_exec(struct ast_channel *chan, void *data)
 
        res = ast_answer(chan); /* Answer the channel */
 
-       if (!data || ( (sscanf(data, "%d|%d|%d", &silencereqd, &iterations, &timeout) != 3) &&
-               (sscanf(data, "%d|%d", &silencereqd, &iterations) != 2) &&
-               (sscanf(data, "%d", &silencereqd) != 1) ) ) {
+       if (!data || ( (sscanf(data, "%30d|%30d|%30d", &silencereqd, &iterations, &timeout) != 3) &&
+               (sscanf(data, "%30d|%30d", &silencereqd, &iterations) != 2) &&
+               (sscanf(data, "%30d", &silencereqd) != 1) ) ) {
                ast_log(LOG_WARNING, "Using default value of 1000ms, 1 iteration, no timeout\n");
        }
 
index 1a69f6df86f0b5f0dde6ab09ff349e5e1479c413..c2b5b88dacdd0e02a3d7f86bfe0169476202fa99 100644 (file)
@@ -1444,9 +1444,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 
@@ -2672,9 +2672,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 9a1a4297ec9cfe939d337ef0845acd8f60689c1a..081137f571ffe3b5fa9bb7176d401a95acb4b4d4 100644 (file)
@@ -8318,7 +8318,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
 
                stringp = dest + 1;
                s = strsep(&stringp, "/");
-               if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+               if ((res = sscanf(s, "%30d%1c%30d", &x, &opt, &y)) < 1) {
                        ast_log(LOG_WARNING, "Unable to determine group for data %s\n", (char *)data);
                        return NULL;
                }
@@ -8354,7 +8354,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
                        channelmatch = x;
                } 
 #ifdef HAVE_PRI
-               else if ((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) > 1) {
+               else if ((res = sscanf(s, "%30d:%30d%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;
@@ -8377,7 +8377,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
                        p = pris[x].crvs;
                }
 #endif 
-               else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+               else if ((res = sscanf(s, "%30d%1c%30d", &x, &opt, &y)) < 1) {
                        ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data);
                        return NULL;
                } else {
@@ -10626,7 +10626,7 @@ static int dahdi_show_channel(int fd, int argc, char **argv)
                return RESULT_SHOWUSAGE;
 #ifdef HAVE_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;
@@ -11253,7 +11253,7 @@ static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *v
 #ifdef HAVE_PRI
        pri = NULL;
        if (iscrv) {
-               if (sscanf(c, "%d:%n", &trunkgroup, &y) != 1) {
+               if (sscanf(c, "%30d:%n", &trunkgroup, &y) != 1) {
                        ast_log(LOG_WARNING, "CRV must begin with trunkgroup followed by a colon at line %d\n", lineno);
                        return -1;
                }
@@ -11276,9 +11276,9 @@ static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *v
 #endif                 
 
        while ((chan = strsep(&c, ","))) {
-               if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
+               if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) {
                        /* Range */
-               } else if (sscanf(chan, "%d", &start)) {
+               } else if (sscanf(chan, "%30d", &start)) {
                        /* Just one */
                        finish = start;
                } else if (!strcasecmp(chan, "pseudo")) {
@@ -11353,7 +11353,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                        int res;
                        char policy[21] = "";
 
-                       res = sscanf(v->value, "%d,%20s", &confp->chan.buf_no, policy);
+                       res = sscanf(v->value, "%30d,%20s", &confp->chan.buf_no, policy);
                        if (res != 2) {
                                ast_log(LOG_WARNING, "Parsing buffers option data failed, using defaults.\n");
                                confp->chan.buf_no = numbufs;
@@ -11386,11 +11386,11 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                } else if (!strcasecmp(v->name, "dring3context")) {
                        ast_copy_string(drings.ringContext[2].contextData, v->value, sizeof(drings.ringContext[2].contextData));
                } else if (!strcasecmp(v->name, "dring1")) {
-                       sscanf(v->value, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
+                       sscanf(v->value, "%30d,%30d,%30d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
                } else if (!strcasecmp(v->name, "dring2")) {
-                       sscanf(v->value, "%d,%d,%d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
+                       sscanf(v->value, "%30d,%30d,%30d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
                } else if (!strcasecmp(v->name, "dring3")) {
-                       sscanf(v->value, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
+                       sscanf(v->value, "%30d,%30d,%30d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
                } else if (!strcasecmp(v->name, "usecallerid")) {
                        confp->chan.use_callerid = ast_true(v->value);
                } else if (!strcasecmp(v->name, "cidsignalling")) {
@@ -11445,7 +11445,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                } else if (!strcasecmp(v->name, "busycount")) {
                        confp->chan.busycount = atoi(v->value);
                } else if (!strcasecmp(v->name, "busypattern")) {
-                       if (sscanf(v->value, "%d,%d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
+                       if (sscanf(v->value, "%30d,%30d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
                                ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength\n");
                        }
                } else if (!strcasecmp(v->name, "callprogress")) {
@@ -11477,7 +11477,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                                        confp->chan.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 4000 ms at line %d\n", v->lineno);                                   
                                } else {
@@ -11525,15 +11525,15 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                } else if (!strcasecmp(v->name, "transfertobusy")) {
                        confp->chan.transfertobusy = ast_true(v->value);
                } else if (!strcasecmp(v->name, "rxgain")) {
-                       if (sscanf(v->value, "%f", &confp->chan.rxgain) != 1) {
+                       if (sscanf(v->value, "%30f", &confp->chan.rxgain) != 1) {
                                ast_log(LOG_WARNING, "Invalid rxgain: %s\n", v->value);
                        }
                } else if (!strcasecmp(v->name, "txgain")) {
-                       if (sscanf(v->value, "%f", &confp->chan.txgain) != 1) {
+                       if (sscanf(v->value, "%30f", &confp->chan.txgain) != 1) {
                                ast_log(LOG_WARNING, "Invalid txgain: %s\n", v->value);
                        }
                } else if (!strcasecmp(v->name, "tonezone")) {
-                       if (sscanf(v->value, "%d", &confp->chan.tonezone) != 1) {
+                       if (sscanf(v->value, "%30d", &confp->chan.tonezone) != 1) {
                                ast_log(LOG_WARNING, "Invalid tonezone: %s\n", v->value);
                        }
                } else if (!strcasecmp(v->name, "callerid")) {
@@ -11897,7 +11897,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
 
                                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 40935acbc602298f6a31416df3cd1a4a87acee42..700fdd174e35eeb0ca149a3703e8698a53a07267 100644 (file)
@@ -2890,7 +2890,7 @@ static int reload_config(int is_reload)
                                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 0bdc40176f4669d0da75a56518abaa315af7e842..75a049e18ee2f8fd110e52496841cb4f469575dd 100644 (file)
@@ -9837,18 +9837,18 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
                                        peer->maxms = 0;
                                } else if (!strcasecmp(v->value, "yes")) {
                                        peer->maxms = DEFAULT_MAXMS;
-                               } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+                               } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
                                        ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
                                        peer->maxms = 0;
                                }
                        } else if (!strcasecmp(v->name, "qualifysmoothing")) {
                                peer->smoothing = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "qualifyfreqok")) {
-                               if (sscanf(v->value, "%d", &peer->pokefreqok) != 1) {
+                               if (sscanf(v->value, "%30d", &peer->pokefreqok) != 1) {
                                        ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when OK should a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
                                }
                        } else if (!strcasecmp(v->name, "qualifyfreqnotok")) {
-                               if (sscanf(v->value, "%d", &peer->pokefreqnotok) != 1) {
+                               if (sscanf(v->value, "%30d", &peer->pokefreqnotok) != 1) {
                                        ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when NOT OK should be a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
                                } else ast_log(LOG_WARNING, "Set peer->pokefreqnotok to %d\n", peer->pokefreqnotok);
                        } else if (!strcasecmp(v->name, "timezone")) {
@@ -10392,7 +10392,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 1d5114bee402534ec6ccb601e856a112b1b9ec22..159657b855b65cffcf179c04cb011590631f43fa 100644 (file)
@@ -1863,7 +1863,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;
        }
@@ -1878,7 +1878,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);
@@ -1894,7 +1894,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, 0);
@@ -2028,7 +2028,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);
@@ -3320,7 +3320,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) {
@@ -3378,7 +3378,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) {
@@ -4170,7 +4170,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;
@@ -4185,7 +4185,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 9c46ee17c5f1b225c7be6079157c76ab3949d790..489cac42856071a1bef1d11e1d31369f2109fead 100644 (file)
@@ -1135,7 +1135,7 @@ static int misdn_show_config (int fd, int argc, char *argv[])
                        }
                        return ok ? 0 : RESULT_SHOWUSAGE;
                }
-               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 d3730eb489a7e36f8667e960239c8e6fbf7d8b33..53885c02e2d3bf4752089adda158e3b120e6cd9d 100644 (file)
@@ -1577,7 +1577,7 @@ static char active_usage[] =
 static void store_boost(struct chan_oss_pvt *o, char *s)
 {
        double boost = 0;
-       if (sscanf(s, "%lf", &boost) != 1) {
+       if (sscanf(s, "%30lf", &boost) != 1) {
                ast_log(LOG_WARNING, "invalid boost <%s>\n", s);
                return;
        }
index 55bda8b724bc9d9988ca479f47450848e028cfdd..fd202844bb76051af3a66107635c037884f78132 100644 (file)
@@ -1243,7 +1243,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 52f4708fda92cce36c892b70bb9658fb22d27f4b..455516e4c926d2856b3c524873f75dbe51c36053 100644 (file)
@@ -2086,7 +2086,7 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res
        if (resp) {
                ast_set_flag(pkt, FLAG_RESPONSE);
                /* Parse out the response code */
-               if (sscanf(pkt->data, "SIP/2.0 %d", &respid) == 1) {
+               if (sscanf(pkt->data, "SIP/2.0 %30d", &respid) == 1) {
                        pkt->response_code = respid;
                }
        }
@@ -2144,7 +2144,7 @@ static int __sip_autodestruct(const void *data)
                if (option_debug > 2)
                        ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP call %s\n", p->callid ? p->callid : "<unknown>");
                append_history(p, "ReliableXmit", "timeout");
-               if (sscanf(p->lastmsg, "Tx: %s", method_str) == 1 || sscanf(p->lastmsg, "Rx: %s", method_str) == 1) {
+               if (sscanf(p->lastmsg, "Tx: %30s", method_str) == 1 || sscanf(p->lastmsg, "Rx: %30s", method_str) == 1) {
                        if (method_match(SIP_CANCEL, method_str) || method_match(SIP_BYE, method_str)) {
                                ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
                        }
@@ -2994,7 +2994,7 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer, struct sockadd
        if (sin) {
                memcpy(&dialog->sa.sin_addr, &sin->sin_addr, sizeof(dialog->sa.sin_addr));
                if (!sin->sin_port) {
-                       if (ast_strlen_zero(port) || sscanf(port, "%u", &portno) != 1) {
+                       if (ast_strlen_zero(port) || sscanf(port, "%30u", &portno) != 1) {
                                portno = STANDARD_SIP_PORT;
                        }
                } else {
@@ -5062,7 +5062,7 @@ static int find_sdp(struct sip_request *req)
        content_length = get_header(req, "Content-Length");
 
        if (!ast_strlen_zero(content_length)) {
-               if (sscanf(content_length, "%ud", &x) != 1) {
+               if (sscanf(content_length, "%30u", &x) != 1) {
                        ast_log(LOG_WARNING, "Invalid Content-Length: %s\n", content_length);
                        return 0;
                }
@@ -5192,10 +5192,10 @@ static int get_ip_and_port_from_sdp(struct sip_request *req, const enum media_ty
        }
        /* We only want the m and c lines for audio */
        for (m = get_sdp_iterate(&miterator, req, "m"); !ast_strlen_zero(m); m = get_sdp_iterate(&miterator, req, "m")) {
-               if ((media == SDP_AUDIO && ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
-                   (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1 && len > 0))) ||
-                       (media == SDP_VIDEO && ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
-                   (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1 && len > 0)))) {
+               if ((media == SDP_AUDIO && ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+                   (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1 && len > 0))) ||
+                       (media == SDP_VIDEO && ((sscanf(m, "video %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+                   (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1 && len > 0)))) {
                        /* See if there's a c= line for this media stream.
                         * XXX There is no guarantee that we'll be grabbing the c= line for this
                         * particular media stream here. However, this is the same logic used in process_sdp.
@@ -5332,8 +5332,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
 
                numberofports = 1;
                len = -1;
-               if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
-                   (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
+               if ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+                   (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
                        audio = TRUE;
                        p->offered_media[SDP_AUDIO].offered = TRUE;
                        numberofmediastreams++;
@@ -5343,7 +5343,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                        codecs = m + len;
                        ast_copy_string(p->offered_media[SDP_AUDIO].text, codecs, sizeof(p->offered_media[SDP_AUDIO].text));
                        for (; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
-                               if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+                               if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
                                        ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
                                        return -1;
                                }
@@ -5351,8 +5351,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                        ast_verbose("Found RTP audio format %d\n", codec);
                                ast_rtp_set_m_type(newaudiortp, codec);
                        }
-               } else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
-                   (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1 && len >= 0)) {
+               } else if ((sscanf(m, "video %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+                   (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1 && len >= 0)) {
                        /* If it is not audio - is it video ? */
                        ast_clear_flag(&p->flags[0], SIP_NOVIDEO);
                        p->offered_media[SDP_VIDEO].offered = TRUE;
@@ -5362,7 +5362,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                        codecs = m + len;
                        ast_copy_string(p->offered_media[SDP_VIDEO].text, codecs, sizeof(p->offered_media[SDP_VIDEO].text));
                        for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
-                               if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+                               if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
                                        ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
                                        return -1;
                                }
@@ -5370,8 +5370,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                        ast_verbose("Found RTP video format %d\n", codec);
                                ast_rtp_set_m_type(newvideortp, codec);
                        }
-               } else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1 && len > 0) || 
-                (sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1 && len >= 0) )) {
+               } else if (p->udptl && ( (sscanf(m, "image %30d udptl t38%n", &x, &len) == 1 && len > 0) || 
+                (sscanf(m, "image %30d UDPTL t38%n", &x, &len) == 1 && len >= 0) )) {
                        if (debug)
                                ast_verbose("Got T.38 offer in SDP in dialog %s\n", p->callid);
                        p->offered_media[SDP_IMAGE].offered = TRUE;
@@ -5557,7 +5557,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                ast_rtp_codec_setpref(p->rtp, pref);
                        }
                        continue;
-               } else if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) == 2) {
+               } else if (sscanf(a, "rtpmap: %30u %[^/]/", &codec, mimeSubtype) == 2) {
                        /* We have a rtpmap to handle */
                        int found = FALSE;
                        /* We should propably check if this is an audio or video codec
@@ -5607,11 +5607,11 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                /* Scan trough the a= lines for T38 attributes and set apropriate fileds */
                iterator = req->sdp_start;
                while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
-                       if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
+                       if ((sscanf(a, "T38FaxMaxBuffer:%30d", &x) == 1)) {
                                found = 1;
                                if (option_debug > 2)
                                        ast_log(LOG_DEBUG, "MaxBufferSize:%d\n",x);
-                       } else if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1) || (sscanf(a, "T38FaxMaxRate:%d", &x) == 1)) {
+                       } else if ((sscanf(a, "T38MaxBitRate:%30d", &x) == 1) || (sscanf(a, "T38FaxMaxRate:%30d", &x) == 1)) {
                                found = 1;
                                if (option_debug > 2)
                                        ast_log(LOG_DEBUG,"T38MaxBitRate: %d\n",x);
@@ -5635,7 +5635,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                        peert38capability |= T38FAX_RATE_2400;
                                        break;
                                }
-                       } else if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
+                       } else if ((sscanf(a, "T38FaxVersion:%30d", &x) == 1)) {
                                found = 1;
                                if (option_debug > 2)
                                        ast_log(LOG_DEBUG, "FaxVersion: %d\n",x);
@@ -5643,7 +5643,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                        peert38capability |= T38FAX_VERSION_0;
                                else if (x == 1)
                                        peert38capability |= T38FAX_VERSION_1;
-                       } else if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1) || (sscanf(a, "T38MaxDatagram:%d", &x) == 1)) {
+                       } else if ((sscanf(a, "T38FaxMaxDatagram:%30d", &x) == 1) || (sscanf(a, "T38MaxDatagram:%30d", &x) == 1)) {
                                found = 1;
                                if (option_debug > 2)
                                        ast_log(LOG_DEBUG, "FaxMaxDatagram: %d\n",x);
@@ -5651,7 +5651,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                ast_udptl_set_local_max_datagram(p->udptl, x);
                        } else if ((strncmp(a, "T38FaxFillBitRemoval", 20) == 0)) {
                                found = 1;
-                               if ((sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1)) {
+                               if ((sscanf(a, "T38FaxFillBitRemoval:%30d", &x) == 1)) {
                                    if (option_debug > 2)
                                            ast_log(LOG_DEBUG, "FillBitRemoval: %d\n",x);
                                    if (x == 1)
@@ -5663,7 +5663,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                }
                        } else if ((strncmp(a, "T38FaxTranscodingMMR", 20) == 0)) {
                                found = 1;
-                               if ((sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1)) {
+                               if ((sscanf(a, "T38FaxTranscodingMMR:%30d", &x) == 1)) {
                                    if (option_debug > 2)
                                            ast_log(LOG_DEBUG, "Transcoding MMR: %d\n",x);
                                    if (x == 1)
@@ -5675,7 +5675,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
                                }
                        } else if ((strncmp(a, "T38FaxTranscodingJBIG", 21) == 0)) {
                                found = 1;
-                               if ((sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1)) {
+                               if ((sscanf(a, "T38FaxTranscodingJBIG:%30d", &x) == 1)) {
                                    if (option_debug > 2)
                                            ast_log(LOG_DEBUG, "Transcoding JBIG: %d\n",x);
                                    if (x == 1)
@@ -6357,7 +6357,7 @@ static int __transmit_response(struct sip_pvt *p, const char *msg, const struct
        struct sip_request resp;
        int seqno = 0;
 
-       if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+       if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
                ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
                return -1;
        }
@@ -6499,7 +6499,7 @@ static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, const
        char tmp[512];
        int seqno = 0;
 
-       if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+       if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
                ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
                return -1;
        }
@@ -6993,7 +6993,7 @@ static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct s
        struct sip_request resp;
        int seqno;
        
-       if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) {
+       if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
                ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
                return -1;
        }
@@ -7031,7 +7031,7 @@ static int transmit_response_with_sdp(struct sip_pvt *p, const char *msg, const
 {
        struct sip_request resp;
        int seqno;
-       if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) {
+       if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
                ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
                return -1;
        }
@@ -8467,7 +8467,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
                if (expires) {
                        /* XXX bug here, we overwrite the string */
                        expires = strsep((char **) &expires, ";"); /* trim ; and beyond */
-                       if (sscanf(expires + 9, "%d", &expiry) != 1)
+                       if (sscanf(expires + 9, "%30d", &expiry) != 1)
                                expiry = default_expiry;
                } else {
                        /* Nothing has been specified */
@@ -12281,7 +12281,7 @@ static int func_header_read(struct ast_channel *chan, char *function, char *data
        if (!args.number) {
                number = 1;
        } else {
-               sscanf(args.number, "%d", &number);
+               sscanf(args.number, "%30d", &number);
                if (number < 1)
                        number = 1;
        }
@@ -13097,7 +13097,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;
                        }
 
@@ -16171,7 +16171,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;
        }
@@ -16196,7 +16196,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
                if (ast_strlen_zero(e)) {
                        return 0;
                }
-               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);
                        return 0;
                }
@@ -17712,7 +17712,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                if (realtime && !strcasecmp(v->name, "regseconds")) {
                        ast_get_time_t(v->value, &regseconds, 0, NULL);
                } else if (realtime && !strcasecmp(v->name, "lastms")) {
-                       sscanf(v->value, "%d", &peer->lastms);
+                       sscanf(v->value, "%30d", &peer->lastms);
                } else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
                        inet_aton(v->value, &(peer->addr.sin_addr));
                } else if (realtime && !strcasecmp(v->name, "name"))
@@ -17867,17 +17867,17 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                } else if (!strcasecmp(v->name, "autoframing")) {
                        peer->autoframing = ast_true(v->value);
                } else if (!strcasecmp(v->name, "rtptimeout")) {
-                       if ((sscanf(v->value, "%d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
+                       if ((sscanf(v->value, "%30d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
                                ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d.  Using default.\n", v->value, v->lineno);
                                peer->rtptimeout = global_rtptimeout;
                        }
                } else if (!strcasecmp(v->name, "rtpholdtimeout")) {
-                       if ((sscanf(v->value, "%d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
+                       if ((sscanf(v->value, "%30d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
                                ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d.  Using default.\n", v->value, v->lineno);
                                peer->rtpholdtimeout = global_rtpholdtimeout;
                        }
                } else if (!strcasecmp(v->name, "rtpkeepalive")) {
-                       if ((sscanf(v->value, "%d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
+                       if ((sscanf(v->value, "%30d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
                                ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d.  Using default.\n", v->value, v->lineno);
                                peer->rtpkeepalive = global_rtpkeepalive;
                        }
@@ -17896,7 +17896,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                                peer->maxms = 0;
                        } else if (!strcasecmp(v->value, "yes")) {
                                peer->maxms = default_qualify ? default_qualify : DEFAULT_MAXMS;
-                       } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+                       } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
                                ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno);
                                peer->maxms = 0;
                        }
@@ -18164,24 +18164,24 @@ static int reload_config(enum channelreloadreason reason)
                } else if (!strcasecmp(v->name, "relaxdtmf")) {
                        global_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(default_vmexten, v->value, sizeof(default_vmexten));
                } else if (!strcasecmp(v->name, "rtptimeout")) {
-                       if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
+                       if ((sscanf(v->value, "%30d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
                                ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d.  Using default.\n", v->value, v->lineno);
                                global_rtptimeout = 0;
                        }
                } else if (!strcasecmp(v->name, "rtpholdtimeout")) {
-                       if ((sscanf(v->value, "%d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
+                       if ((sscanf(v->value, "%30d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
                                ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d.  Using default.\n", v->value, v->lineno);
                                global_rtpholdtimeout = 0;
                        }
                } else if (!strcasecmp(v->name, "rtpkeepalive")) {
-                       if ((sscanf(v->value, "%d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
+                       if ((sscanf(v->value, "%30d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
                                ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d.  Using default.\n", v->value, v->lineno);
                                global_rtpkeepalive = 0;
                        }
@@ -18226,7 +18226,7 @@ static int reload_config(enum channelreloadreason reason)
                                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);
@@ -18287,7 +18287,7 @@ static int reload_config(enum channelreloadreason reason)
                                memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr));
                        externexpire = time(NULL);
                } 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;
                        }
@@ -18335,7 +18335,7 @@ static int reload_config(enum channelreloadreason reason)
                        if (ast_str2tos(v->value, &global_tos_video))
                                ast_log(LOG_WARNING, "Invalid tos_video value at line %d, recommended value is 'af41'. See doc/ip-tos.txt.\n", v->lineno);
                } else if (!strcasecmp(v->name, "bindport")) {
-                       if (sscanf(v->value, "%d", &ourport) == 1) {
+                       if (sscanf(v->value, "%5d", &ourport) == 1) {
                                bindaddr.sin_port = htons(ourport);
                        } else {
                                ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -18345,7 +18345,7 @@ static int reload_config(enum channelreloadreason reason)
                                default_qualify = 0;
                        } else if (!strcasecmp(v->value, "yes")) {
                                default_qualify = DEFAULT_MAXMS;
-                       } else if (sscanf(v->value, "%d", &default_qualify) != 1) {
+                       } else if (sscanf(v->value, "%30d", &default_qualify) != 1) {
                                ast_log(LOG_WARNING, "Qualification default should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", v->lineno);
                                default_qualify = 0;
                        }
@@ -18962,7 +18962,7 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
                        memset(lport, 0, sizeof(lport));
                        localtmp++;
                        /* This is okey because lhost and lport are as big as tmp */
-                       sscanf(localtmp, "%[^<>:; ]:%[^<>:; ]", lhost, lport);
+                       sscanf(localtmp, "%80[^<>:; ]:%80[^<>:; ]", lhost, lport);
                        if (ast_strlen_zero(lhost)) {
                                ast_log(LOG_ERROR, "Can't find the host address\n");
                                return 0;
index 90e59c2a3c91e5c7ce1744e73e7c2d855605e4bb..812aa16fb5524ee0417739facf64eac532f52d08 100644 (file)
@@ -4760,7 +4760,7 @@ static int reload_config(void)
                } else if (!strcasecmp(v->name, "disallow")) {
                        ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 0);
                } else if (!strcasecmp(v->name, "bindport") || !strcasecmp(v->name, "port")) {
-                       if (sscanf(v->value, "%d", &ourport) == 1) {
+                       if (sscanf(v->value, "%5d", &ourport) == 1) {
                                bindaddr.sin_port = htons(ourport);
                        } else {
                                ast_log(LOG_WARNING, "Invalid bindport '%s' at line %d of %s\n", v->value, v->lineno, config);
index b6137a88b51cbaf7564b6c015f84bd0998f84a04..b980cfea01f4749d5765b89bc601eb11f27ead87 100644 (file)
@@ -246,7 +246,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)
@@ -305,7 +305,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;
index 71f54adcc549c9eff880fc74e4b6e8459aef4c66..1cbd190212f9b3a4ce8ef3dac782956778482e1e 100644 (file)
@@ -891,9 +891,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));
@@ -907,7 +907,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);
@@ -974,7 +974,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%s", &start, &end, ptpbuf) >= 2) {
                                        for (; start <= end; start++) {
                                                if (start <= max_ports && start > 0) {
                                                        cfg_for_ports[start] = 1;
@@ -983,7 +983,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%s", &start, ptpbuf)) {
                                                if (start <= max_ports && start > 0) {
                                                        cfg_for_ports[start] = 1;
                                                        ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0;
index 6eff087d33b50d50a9a48f1d509e694f60efd6ea..c2b4a4369e1a429f971e8703b7e3c4d62a2f974d 100644 (file)
@@ -402,7 +402,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);
                                vbr_quality = res_f;
@@ -451,7 +451,7 @@ static void parse_config(void)
                        if (option_verbose > 2)
                                ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
                } else if (!strcasecmp(var->name, "pp_agc_level")) {
-                       if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) {
+                       if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
                                if (option_verbose > 2)
                                        ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
                                pp_agc_level = res_f;
@@ -466,14 +466,14 @@ static void parse_config(void)
                        if (option_verbose > 2)
                                ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
                } else if (!strcasecmp(var->name, "pp_dereverb_decay")) {
-                       if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) {
+                       if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
                                if (option_verbose > 2)
                                        ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
                                pp_dereverb_decay = res_f;
                        } else
                                ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Decay must be >= 0\n");
                } else if (!strcasecmp(var->name, "pp_dereverb_level")) {
-                       if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) {
+                       if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
                                if (option_verbose > 2)
                                        ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
                                pp_dereverb_level = res_f;
index c3ffacd3c5302e7c7f90fc717a4dc641a4b73426..1eb4c88a0cedfd2206fd434b602d6ebcbb629e5e 100644 (file)
@@ -284,6 +284,17 @@ you wish to put into it (even if you did not allocate the buffer yourself),
 use a direct strcpy(), as it can be inlined and optimized to simple
 processor operations, unlike ast_copy_string().
 
+* String conversions
+--------------------
+
+When converting from strings to integers or floats, use the sscanf function
+in preference to the atoi and atof family of functions, as sscanf detects
+errors.  Always check the return value of sscanf to verify that your numeric
+variables successfully scanned before using them.  Also, to avoid a potential
+libc bug, always specify a maximum width for each format specifier, including
+integers and floats.  A good length for both integers and floats is 30, as
+this is more than generous, even if you're using doubles or long integers.
+
 * Use of functions
 ------------------
 
index d2e5c2c6724cad647880083ac5d40cb7811af14b..99f6d1e61812266e4c6db8b4c2d84a622c4b5e74 100644 (file)
@@ -116,10 +116,10 @@ static int func_channel_write(struct ast_channel *chan, char *function,
        } else if (!strcasecmp(data, "callgroup"))
                chan->callgroup = ast_get_group(value);
        else if (!strcasecmp(data, "txgain")) {
-               sscanf(value, "%hhd", &gainset);
+               sscanf(value, "%4hhd", &gainset);
                ast_channel_setoption(chan, AST_OPTION_TXGAIN, &gainset, sizeof(gainset), 0);
        } else if (!strcasecmp(data, "rxgain")) {
-               sscanf(value, "%hhd", &gainset);
+               sscanf(value, "%4hhd", &gainset);
                ast_channel_setoption(chan, AST_OPTION_RXGAIN, &gainset, sizeof(gainset), 0);
        } else if (!strcasecmp(data, "transfercapability")) {
                unsigned short i;
index 66f464dd6dc863e81d618ae464ceb7586c41c3bc..9e95092ac02e862609326b364c939c3db87b4981 100644 (file)
@@ -96,7 +96,7 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz
                }
                *ptrvalue++ = '\0';
                sortable_keys[count2].key = ptrkey;
-               sscanf(ptrvalue, "%f", &sortable_keys[count2].value);
+               sscanf(ptrvalue, "%30f", &sortable_keys[count2].value);
                count2++;
        }
 
@@ -173,15 +173,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 edded75755d9ca4215522c212da910727a579229..76d9deff608f8bc924ddef53506d915a220f8572 100644 (file)
@@ -165,12 +165,12 @@ static int math(struct ast_channel *chan, char *cmd, char *parse,
                return -1;
        }
 
-       if (sscanf(mvalue1, "%lf", &fnum1) != 1) {
+       if (sscanf(mvalue1, "%30lf", &fnum1) != 1) {
                ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue1);
                return -1;
        }
 
-       if (sscanf(mvalue2, "%lf", &fnum2) != 1) {
+       if (sscanf(mvalue2, "%30lf", &fnum2) != 1) {
                ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue2);
                return -1;
        }
index 53952d341033478422c22a3abfebbedc4a48d4bc..ea6d7d393df125d173d886f08d810329f497e3b0 100644 (file)
@@ -53,10 +53,10 @@ static int acf_rand_exec(struct ast_channel *chan, char *cmd,
 
        AST_STANDARD_APP_ARGS(args, parse);
 
-       if (ast_strlen_zero(args.min) || sscanf(args.min, "%d", &min_int) != 1)
+       if (ast_strlen_zero(args.min) || sscanf(args.min, "%30d", &min_int) != 1)
                min_int = 0;
 
-       if (ast_strlen_zero(args.max) || sscanf(args.max, "%d", &max_int) != 1)
+       if (ast_strlen_zero(args.max) || sscanf(args.max, "%30d", &max_int) != 1)
                max_int = RAND_MAX;
 
        if (max_int < min_int) {
index b0e7dfb5084ddbd6d8a7a8b639fc8a5fcf54209f..68f806ff1ee6aec9e78e8498c49d14efe8b1a600 100644 (file)
@@ -289,7 +289,7 @@ static int acf_sprintf(struct ast_channel *chan, char *cmd, char *data, char *bu
 
                                /* Convert the argument into the required type */
                                if (arg.var[argcount]) {
-                                       if (sscanf(arg.var[argcount++], "%d", &tmpi) != 1) {
+                                       if (sscanf(arg.var[argcount++], "%30d", &tmpi) != 1) {
                                                ast_log(LOG_ERROR, "Argument '%s' is not an integer number for format '%s'\n", arg.var[argcount - 1], formatbuf);
                                                goto sprintf_fail;
                                        }
@@ -312,7 +312,7 @@ static int acf_sprintf(struct ast_channel *chan, char *cmd, char *data, char *bu
 
                                /* Convert the argument into the required type */
                                if (arg.var[argcount]) {
-                                       if (sscanf(arg.var[argcount++], "%lf", &tmpd) != 1) {
+                                       if (sscanf(arg.var[argcount++], "%30lf", &tmpd) != 1) {
                                                ast_log(LOG_ERROR, "Argument '%s' is not a floating point number for format '%s'\n", arg.var[argcount - 1], formatbuf);
                                                goto sprintf_fail;
                                        }
index 4a5e16485aa608203360fdce5cc03584e1c66b6f..8f388a3d704f3bbc34a533b9fe86c07eb3fb96e6 100644 (file)
@@ -328,7 +328,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;
@@ -447,7 +447,7 @@ int ast_str2tos(const char *value, unsigned int *tos)
        int fval;
        unsigned int x;
 
-       if (sscanf(value, "%i", &fval) == 1) {
+       if (sscanf(value, "%30i", &fval) == 1) {
                *tos = fval & 0xFF;
                return 0;
        }
index e0b76eab13fed12954e6d08d6059481ac979ffde..d915b4bdb0cc26c294c5a61d24a4121d3ab4d280 100644 (file)
@@ -1117,7 +1117,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));
@@ -1891,10 +1891,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;
                                        }
@@ -1940,13 +1940,13 @@ static char *cli_prompt(EditLine *el)
                                                float avg1, avg2, avg3;
                                                int actproc, totproc, npid, which;
 
-                                               if (fscanf(LOADAVG, "%f %f %f %d/%d %d",
+                                               if (fscanf(LOADAVG, "%30f %30f %30f %30d/%30d %30d",
                                                           &avg1, &avg2, &avg3, &actproc, &totproc, &npid) != 6) {
                                                        ast_log(LOG_WARNING, "parsing /proc/loadavg failed\n");
                                                        fclose(LOADAVG);
                                                        break;
                                                }
-                                               if (sscanf(t, "%d", &which) == 1) {
+                                               if (sscanf(t, "%30d", &which) == 1) {
                                                        switch (which) {
                                                        case 1:
                                                                snprintf(p, sizeof(prompt) - strlen(prompt), "%.2f", avg1);
@@ -2582,7 +2582,7 @@ static void ast_readconfig(void)
                /* debug level (-d at startup) */
                } else if (!strcasecmp(v->name, "debug")) {
                        option_debug = 0;
-                       if (sscanf(v->value, "%d", &option_debug) != 1) {
+                       if (sscanf(v->value, "%30d", &option_debug) != 1) {
                                option_debug = ast_true(v->value);
                        }
 #if HAVE_WORKING_FORK
@@ -2630,7 +2630,7 @@ static void ast_readconfig(void)
                } else if (!strcasecmp(v->name, "internal_timing")) {
                        ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INTERNAL_TIMING);
                } else if (!strcasecmp(v->name, "maxcalls")) {
-                       if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
+                       if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
                                option_maxcalls = 0;
                        }
                } else if (!strcasecmp(v->name, "maxload")) {
@@ -2639,7 +2639,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 */
@@ -2774,11 +2774,11 @@ int main(int argc, char *argv[])
                        ast_set_flag(&ast_options, AST_OPT_FLAG_MUTE);
                        break;
                case 'M':
-                       if ((sscanf(optarg, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0))
+                       if ((sscanf(optarg, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0))
                                option_maxcalls = 0;
                        break;
                case 'L':
-                       if ((sscanf(optarg, "%lf", &option_maxload) != 1) || (option_maxload < 0.0))
+                       if ((sscanf(optarg, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0))
                                option_maxload = 0.0;
                        break;
                case 'q':
index cd051003baddb244a2f07390d915e2e21337a18b..1e413c640b730c0b56d0d8affb5354243ef57d2a 100644 (file)
@@ -1428,7 +1428,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 (cfg_size < 0)
                                ast_log(LOG_WARNING, "Invalid maximum batch size '%d' specified, using default\n", cfg_size);
@@ -1436,7 +1436,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 (cfg_time < 0)
                                ast_log(LOG_WARNING, "Invalid maximum batch time '%d' specified, using default\n", cfg_time);
index 6b1582180fd0a3acf7c928fc0848321b9b919533..5e0dc8d55d62a051d421b426b3203f5278cfcc7d 100644 (file)
@@ -4785,9 +4785,9 @@ ast_group_t ast_get_group(const char *s)
        c = ast_strdupa(s);
        
        while ((piece = strsep(&c, ","))) {
-               if (sscanf(piece, "%d-%d", &start, &finish) == 2) {
+               if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) {
                        /* Range */
-               } else if (sscanf(piece, "%d", &start)) {
+               } else if (sscanf(piece, "%30d", &start)) {
                        /* Just one */
                        finish = start;
                } else {
index fe39334c130d4c44651e83af75c847e3f115bbe3..b928fde634baef7900f62c738009e2a690506fe1 100644 (file)
@@ -319,7 +319,7 @@ static int handle_set_debug(int fd, int argc, char *argv[])
                if (argc > 5)
                        return RESULT_SHOWUSAGE;
 
-               if (sscanf(argv[3], "%d", &newlevel) != 1)
+               if (sscanf(argv[3], "%30d", &newlevel) != 1)
                        return RESULT_SHOWUSAGE;
 
                if (argc == 4) {
@@ -334,7 +334,7 @@ static int handle_set_debug(int fd, int argc, char *argv[])
                if (argc < 5 || argc > 6)
                        return RESULT_SHOWUSAGE;
 
-               if (sscanf(argv[4], "%d", &newlevel) != 1)
+               if (sscanf(argv[4], "%30d", &newlevel) != 1)
                        return RESULT_SHOWUSAGE;
 
                if (argc == 5) {
@@ -387,7 +387,7 @@ static int handle_debuglevel_deprecated(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], "%30d", &newlevel) != 1)
                return RESULT_SHOWUSAGE;
        option_debug = newlevel;
        if (argc == 4) {
index deb5c73dbe9b2ec54603d3ac528a75b8633db976..6be5720d045de0813fab9236a7e9f9f22c0cdad4 100644 (file)
@@ -380,7 +380,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);
index cf13b6a2990aad6cdf6a10543b093f153ec60f8c..9de8a700a008eb017f5462d61b9128e5c2b18aa1 100644 (file)
@@ -765,7 +765,7 @@ static int show_codec_n_deprecated(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++)
@@ -787,7 +787,7 @@ static int show_codec_n(int fd, int argc, char *argv[])
        if (argc != 4)
                return RESULT_SHOWUSAGE;
 
-       if (sscanf(argv[3],"%d",&codec) != 1)
+       if (sscanf(argv[3],"%30d",&codec) != 1)
                return RESULT_SHOWUSAGE;
 
        for (i = 0; i < 32; i++)
index 64f96b5d57b87832f37aa2621ebff26b4a62d63d..8255e20f0956d033135449d4f4bcf160a219395e 100644 (file)
@@ -236,46 +236,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 f62611fce9b3af9656c5e69d6195e0263f78f9dc..a8bd1edbbd9eb12abc79651b13676d1dc03bce01 100644 (file)
@@ -1329,7 +1329,7 @@ static int action_waitevent(struct mansession *s, const struct message *m)
                snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
 
        if (!ast_strlen_zero(timeouts)) {
-               sscanf(timeouts, "%i", &timeout);
+               sscanf(timeouts, "%30i", &timeout);
        }
        
        ast_mutex_lock(&s->session->__lock);
@@ -1690,7 +1690,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
                astman_send_error(s, m, "Channel not specified");
                return 0;
        }
-       if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
+       if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) {
                if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
                        astman_send_error(s, m, "Invalid priority");
                        return 0;
@@ -1938,13 +1938,13 @@ static int action_originate(struct mansession *s, const struct message *m)
                astman_send_error(s, m, "Channel not specified");
                return 0;
        }
-       if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
+       if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) {
                if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
                        astman_send_error(s, m, "Invalid priority");
                        return 0;
                }
        }
-       if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%d", &to) != 1)) {
+       if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%30d", &to) != 1)) {
                astman_send_error(s, m, "Invalid timeout");
                return 0;
        }
@@ -2790,7 +2790,7 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co
 
        for (v = params; v; v = v->next) {
                if (!strcasecmp(v->name, "mansession_id")) {
-                       sscanf(v->value, "%x", &ident);
+                       sscanf(v->value, "%30x", &ident);
                        break;
                }
        }
@@ -3068,7 +3068,7 @@ int init_manager(void)
                webenabled = 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;
                }
index b3a44821499bdb3f4bba14d11eb64bb9e6febc7e..f34661ce5d9401cb066a10667ee78741e47a859b 100644 (file)
@@ -1095,7 +1095,7 @@ static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
                        parens--;
                } else if (*var == ':' && parens == 0) {
                        *var++ = '\0';
-                       sscanf(var, "%d:%d", offset, length);
+                       sscanf(var, "%30d:%30d", offset, length);
                        return 1; /* offset:length valid */
                }
        }
@@ -4069,7 +4069,7 @@ static int lookup_name(const char *s, char *const names[], int max)
                        if (!strcasecmp(s, names[i]))
                                return i+1;
                }
-       } else if (sscanf(s, "%d", &i) == 1 && i >= 1 && i <= max) {
+       } else if (sscanf(s, "%30d", &i) == 1 && i >= 1 && i <= max) {
                return i;
        }
        return 0; /* error return */
@@ -4156,11 +4156,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;
        }
@@ -5369,7 +5369,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);
@@ -6410,7 +6410,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 ? 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 6ff44dd48e180b2c336245761139227b0db1d3f7..8c601b3d71a30d848bf6d5b83cbb73c25e36f0c5 100644 (file)
@@ -1349,7 +1349,7 @@ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
                return -1;
 
        /* only integer at the moment, but one day we could accept more formats */
-       if (sscanf(src, "%ld%n", &t, &scanned) == 1) {
+       if (sscanf(src, "%30ld%n", &t, &scanned) == 1) {
                *dst = t;
                if (consumed)
                        *consumed = scanned;
index 14ef9e740f4797e4f87509a0b4151a828812ad37..0f994797ffaa04cdebc8d4101c50f2bdeb8b3ce3 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 655d0963292b13058417e6820b0ed179d4997114..d999caacc0de349964d06e69ced23bddece9ed2b 100644 (file)
@@ -877,12 +877,12 @@ static void check_timerange(pval *p)
                                p->filename, p->startline, p->endline, p->u1.str);
                warns++;
        }
-       if (sscanf(times, "%d:%d", &s1, &s2) != 2) {
+       if (sscanf(times, "%2d:%2d", &s1, &s2) != 2) {
                ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The start time (%s) isn't quite right!\n",
                                p->filename, p->startline, p->endline, times);
                warns++;
        }
-       if (sscanf(e, "%d:%d", &e1, &e2) != 2) {
+       if (sscanf(e, "%2d:%2d", &e1, &e2) != 2) {
                ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The end time (%s) isn't quite right!\n",
                                p->filename, p->startline, p->endline, times);
                warns++;
@@ -974,7 +974,7 @@ static void check_day(pval *DAY)
                c++;
        }
        /* Find the start */
-       if (sscanf(day, "%d", &s) != 1) {
+       if (sscanf(day, "%2d", &s) != 1) {
                ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The start day of month (%s) must be a number!\n",
                                DAY->filename, DAY->startline, DAY->endline, day);
                warns++;
@@ -986,7 +986,7 @@ static void check_day(pval *DAY)
        }
        s--;
        if (c) {
-               if (sscanf(c, "%d", &e) != 1) {
+               if (sscanf(c, "%2d", &e) != 1) {
                        ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The end day of month (%s) must be a number!\n",
                                        DAY->filename, DAY->startline, DAY->endline, c);
                        warns++;
index c16d22c9b2b9a78cbec8777fb747af8d7dda0d93..fd79cc48dc6ae78a7f2543199a85fc67c6ee87ff 100644 (file)
@@ -1423,7 +1423,7 @@ static int handle_context_add_extension_deprecated(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;
                        }
@@ -1516,7 +1516,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;
                        }
@@ -2248,7 +2248,7 @@ static int pbx_load_config(const char *config_file)
                                                        ipri = lastpri;
                                                else
                                                        ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n");
-                                       } else if (sscanf(pri, "%d", &ipri) != 1 &&
+                                       } else if (sscanf(pri, "%30d", &ipri) != 1 &&
                                            (ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) {
                                                ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno);
                                                ipri = 0;
@@ -2395,9 +2395,9 @@ static void pbx_load_users(void)
                        c = zapcopy;
                        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 {
index 8052c08fc3838039f995c4d1458f82a4e59aa998..412e24e9a497094d50f767e71d2d7796daa85268 100644 (file)
@@ -1145,7 +1145,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
                        if (expiration > 0) {
                                ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", expiration);
                                ptr += length + 1;
-                               while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
+                               while((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
                                        ptr += length;
                                        term = strchr(ptr, '|');
                                        if (term) {
@@ -4043,7 +4043,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;
@@ -4141,7 +4141,7 @@ static void populate_addr(struct dundi_peer *peer, dundi_eid *eid)
                if (c) {
                        *c = '\0';
                        c++;
-                       if (sscanf(c, "%d:%d", &port, &expire) == 2) {
+                       if (sscanf(c, "%5d:%30d", &port, &expire) == 2) {
                                /* Got it! */
                                inet_aton(data, &peer->addr.sin_addr);
                                peer->addr.sin_family = AF_INET;
@@ -4238,7 +4238,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;
@@ -4473,14 +4473,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
@@ -4496,7 +4496,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;
@@ -4533,7 +4533,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 042cbfb5fc75ab605131e25ce7c5749ba95be4e6..d9a3e737bd4e3c369ac507ca5e1a109758ad129e 100644 (file)
@@ -129,7 +129,7 @@ static void loopback_parse(char **newexten, char **newcontext, int *priority, ch
        if (!ast_strlen_zero(con))
                *newcontext = con;
        if (!ast_strlen_zero(pri))
-               sscanf(pri, "%d", priority);
+               sscanf(pri, "%30d", priority);
 }
 
 static int loopback_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
index 3ab4e83854cb737c6a0aa1b5f0665ade651723a3..30c430b69a4608d592e2973e371a074d6e9009c0 100644 (file)
@@ -190,7 +190,7 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
                                } else if (!strcasecmp(buf, "data")) {
                                        ast_copy_string(o->data, c, sizeof(o->data));
                                } else if (!strcasecmp(buf, "maxretries")) {
-                                       if (sscanf(c, "%d", &o->maxretries) != 1) {
+                                       if (sscanf(c, "%30d", &o->maxretries) != 1) {
                                                ast_log(LOG_WARNING, "Invalid max retries at line %d of %s\n", lineno, fn);
                                                o->maxretries = 0;
                                        }
@@ -201,24 +201,24 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
                                } else if (!strcasecmp(buf, "extension")) {
                                        ast_copy_string(o->exten, c, sizeof(o->exten));
                                } else if (!strcasecmp(buf, "priority")) {
-                                       if ((sscanf(c, "%d", &o->priority) != 1) || (o->priority < 1)) {
+                                       if ((sscanf(c, "%30d", &o->priority) != 1) || (o->priority < 1)) {
                                                ast_log(LOG_WARNING, "Invalid priority at line %d of %s\n", lineno, fn);
                                                o->priority = 1;
                                        }
                                } else if (!strcasecmp(buf, "retrytime")) {
-                                       if ((sscanf(c, "%d", &o->retrytime) != 1) || (o->retrytime < 1)) {
+                                       if ((sscanf(c, "%30d", &o->retrytime) != 1) || (o->retrytime < 1)) {
                                                ast_log(LOG_WARNING, "Invalid retrytime at line %d of %s\n", lineno, fn);
                                                o->retrytime = 300;
                                        }
                                } else if (!strcasecmp(buf, "waittime")) {
-                                       if ((sscanf(c, "%d", &o->waittime) != 1) || (o->waittime < 1)) {
+                                       if ((sscanf(c, "%30d", &o->waittime) != 1) || (o->waittime < 1)) {
                                                ast_log(LOG_WARNING, "Invalid waittime at line %d of %s\n", lineno, fn);
                                                o->waittime = 45;
                                        }
                                } else if (!strcasecmp(buf, "retry")) {
                                        o->retries++;
                                } else if (!strcasecmp(buf, "startretry")) {
-                                       if (sscanf(c, "%ld", &o->callingpid) != 1) {
+                                       if (sscanf(c, "%30ld", &o->callingpid) != 1) {
                                                ast_log(LOG_WARNING, "Unable to retrieve calling PID!\n");
                                                o->callingpid = 0;
                                        }
index 15ecaa516c61f07a55262a618b5cc9067495649f..fe53ebe68021bf5e01f34a90dafdaf5864abe16d 100644 (file)
@@ -448,7 +448,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);
@@ -558,7 +558,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]))
@@ -599,7 +599,7 @@ static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, char
        if (argv[3]) 
                edigits = argv[3];
 
-       if ((argc > 4) && (sscanf(argv[4], "%ld", &sample_offset) != 1))
+       if ((argc > 4) && (sscanf(argv[4], "%30ld", &sample_offset) != 1))
                return RESULT_SHOWUSAGE;
        
        fs = ast_openstream(chan, argv[2], chan->language);     
@@ -720,7 +720,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)
@@ -736,7 +736,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);
@@ -766,7 +766,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)
@@ -781,7 +781,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)
@@ -892,7 +892,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;
        }
@@ -924,7 +924,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)
@@ -965,7 +965,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], '=')))
@@ -1085,7 +1085,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;
@@ -1259,7 +1259,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 b148bb71dd7c803138bb750ea1f39ff4fc93e168..1813268fd042eeaa6dce7ea4d72c2d0935b52fb2 100644 (file)
@@ -367,7 +367,7 @@ static struct parkeduser *park_space_reserve(struct ast_channel *chan)
                 * limitation here.  If extout was not numeric, we could permit
                 * arbitrary non-numeric extensions.
                 */
-               if (sscanf(parkingexten, "%d", &parking_space) != 1 || parking_space < 0) {
+               if (sscanf(parkingexten, "%30d", &parking_space) != 1 || parking_space < 0) {
                        ast_log(LOG_WARNING, "PARKINGEXTEN does not indicate a valid parking slot: '%s'.\n", parkingexten);
                        ast_mutex_unlock(&parking_lock);
                        free(pu);
@@ -2787,7 +2787,7 @@ static int manager_park(struct mansession *s, const struct message *m)
        }
 
        if (!ast_strlen_zero(timeout)) {
-               sscanf(timeout, "%d", &to);
+               sscanf(timeout, "%30d", &to);
        }
 
        res = ast_masq_park_call(ch1, ch2, to, &parkExt);
@@ -2904,13 +2904,13 @@ static int load_config(void)
                } else if (!strcasecmp(var->name, "context")) {
                        ast_copy_string(parking_con, var->value, sizeof(parking_con));
                } else if (!strcasecmp(var->name, "parkingtime")) {
-                       if ((sscanf(var->value, "%d", &parkingtime) != 1) || (parkingtime < 1)) {
+                       if ((sscanf(var->value, "%30d", &parkingtime) != 1) || (parkingtime < 1)) {
                                ast_log(LOG_WARNING, "%s is not a valid parkingtime\n", var->value);
                                parkingtime = DEFAULT_PARK_TIME;
                        } else
                                parkingtime = parkingtime * 1000;
                } else if (!strcasecmp(var->name, "parkpos")) {
-                       if (sscanf(var->value, "%d-%d", &start, &end) != 2) {
+                       if (sscanf(var->value, "%30d-%30d", &start, &end) != 2) {
                                ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of features.conf\n", var->lineno);
                        } else {
                                parking_start = start;
@@ -2959,18 +2959,18 @@ static int load_config(void)
                } else if (!strcasecmp(var->name, "adsipark")) {
                        adsipark = ast_true(var->value);
                } else if (!strcasecmp(var->name, "transferdigittimeout")) {
-                       if ((sscanf(var->value, "%d", &transferdigittimeout) != 1) || (transferdigittimeout < 1)) {
+                       if ((sscanf(var->value, "%30d", &transferdigittimeout) != 1) || (transferdigittimeout < 1)) {
                                ast_log(LOG_WARNING, "%s is not a valid transferdigittimeout\n", var->value);
                                transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
                        } else
                                transferdigittimeout = transferdigittimeout * 1000;
                } else if (!strcasecmp(var->name, "featuredigittimeout")) {
-                       if ((sscanf(var->value, "%d", &featuredigittimeout) != 1) || (featuredigittimeout < 1)) {
+                       if ((sscanf(var->value, "%30d", &featuredigittimeout) != 1) || (featuredigittimeout < 1)) {
                                ast_log(LOG_WARNING, "%s is not a valid featuredigittimeout\n", var->value);
                                featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
                        }
                } else if (!strcasecmp(var->name, "atxfernoanswertimeout")) {
-                       if ((sscanf(var->value, "%d", &atxfernoanswertimeout) != 1) || (atxfernoanswertimeout < 1)) {
+                       if ((sscanf(var->value, "%30d", &atxfernoanswertimeout) != 1) || (atxfernoanswertimeout < 1)) {
                                ast_log(LOG_WARNING, "%s is not a valid atxfernoanswertimeout\n", var->value);
                                atxfernoanswertimeout = DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER;
                        } else
index be174aab1ba62e033aca9e642502eee02e666bc3..961e300446f759368dc07bbd42ff57a91bfad3fb 100644 (file)
@@ -247,7 +247,7 @@ static int load_odbc_config(void)
                                        if (ast_true(v->value))
                                                pooling = 1;
                                } else if (!strcasecmp(v->name, "limit")) {
-                                       sscanf(v->value, "%d", &limit);
+                                       sscanf(v->value, "%4d", &limit);
                                        if (ast_true(v->value) && !limit) {
                                                ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'.  Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat);
                                                limit = 1023;
@@ -261,7 +261,7 @@ static int load_odbc_config(void)
                                                limit = 1023;
                                        }
                                } else if (!strcasecmp(v->name, "idlecheck")) {
-                                       sscanf(v->value, "%d", &idlecheck);
+                                       sscanf(v->value, "%30u", &idlecheck);
                                } else if (!strcasecmp(v->name, "enabled")) {
                                        enabled = ast_true(v->value);
                                } else if (!strcasecmp(v->name, "pre-connect")) {
@@ -610,7 +610,7 @@ static int reload(void)
                                        if (!strcasecmp(v->name, "pooling")) {
                                                pooling = 1;
                                        } else if (!strcasecmp(v->name, "limit")) {
-                                               sscanf(v->value, "%d", &limit);
+                                               sscanf(v->value, "%4d", &limit);
                                                if (ast_true(v->value) && !limit) {
                                                        ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'.  Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat);
                                                        limit = 1023;
@@ -620,7 +620,7 @@ static int reload(void)
                                                        break;
                                                }
                                        } else if (!strcasecmp(v->name, "idlecheck")) {
-                                               sscanf(v->value, "%ud", &idlecheck);
+                                               sscanf(v->value, "%30u", &idlecheck);
                                        } else if (!strcasecmp(v->name, "enabled")) {
                                                enabled = ast_true(v->value);
                                        } else if (!strcasecmp(v->name, "pre-connect")) {
index f26e2ac25f686056827fab492ef0d287422a0e9e..55179d78dc4219d058d70f311f0a8852c0a1fda0 100644 (file)
@@ -910,7 +910,7 @@ static int smdi_load(int reload)
                                baud_rate = B9600;
                        }
                } else if (!strcasecmp(v->name, "msdstrip")) {
-                       if (!sscanf(v->value, "%d", &msdstrip)) {
+                       if (!sscanf(v->value, "%30d", &msdstrip)) {
                                ast_log(LOG_NOTICE, "Invalid msdstrip value in %s (line %d), using default\n", config_file, v->lineno);
                                msdstrip = 0;
                        } else if (0 > msdstrip || msdstrip > 9) {
@@ -918,7 +918,7 @@ static int smdi_load(int reload)
                                msdstrip = 0;
                        }
                } else if (!strcasecmp(v->name, "msgexpirytime")) {
-                       if (!sscanf(v->value, "%ld", &msg_expiry)) {
+                       if (!sscanf(v->value, "%30ld", &msg_expiry)) {
                                ast_log(LOG_NOTICE, "Invalid msgexpirytime value in %s (line %d), using default\n", config_file, v->lineno);
                                msg_expiry = SMDI_MSG_EXPIRY_TIME;
                        }
@@ -1052,7 +1052,7 @@ static int smdi_load(int reload)
                                continue;
                        }
                } else if (!strcasecmp(v->name, "pollinginterval")) {
-                       if (sscanf(v->value, "%u", &mwi_monitor.polling_interval) != 1) {
+                       if (sscanf(v->value, "%30u", &mwi_monitor.polling_interval) != 1) {
                                ast_log(LOG_ERROR, "Invalid value for pollinginterval: %s\n", v->value);
                                mwi_monitor.polling_interval = DEFAULT_POLLING_INTERVAL;
                        }
@@ -1173,7 +1173,7 @@ static int smdi_msg_retrieve_read(struct ast_channel *chan, char *cmd, char *dat
        }
 
        if (!ast_strlen_zero(args.timeout)) {
-               if (sscanf(args.timeout, "%u", &timeout) != 1) {
+               if (sscanf(args.timeout, "%30u", &timeout) != 1) {
                        ast_log(LOG_ERROR, "'%s' is not a valid timeout\n", args.timeout);
                        timeout = SMDI_RETRIEVE_TIMEOUT_DEFAULT;
                }
index 7fe81af18ccfd36f6b400afb5bae551dbfe0cc66..8df27580c6fe0d55eaef9ceac18ee609f6231490 100644 (file)
@@ -355,7 +355,7 @@ int parsetime(char *string, int *result)
     double temp;
     char m, s, end;
 
-    k = sscanf(string, "%lf%c%c%c", &temp, &m, &s, &end);
+    k = sscanf(string, "%30lf%1c%1c%1c", &temp, &m, &s, &end);
     switch (k)
       {
       case 0: case EOF: case 4:
@@ -396,7 +396,7 @@ int parsefreq(char *string, double *result)
     double temp;
     char m, s, end;
 
-    k = sscanf(string, "%lf%c%c%c", &temp, &m, &s, &end);
+    k = sscanf(string, "%30lf%1c%1c%1c", &temp, &m, &s, &end);
     switch (k)
       {
       case 0: case EOF: case 2: case 4:
@@ -476,7 +476,7 @@ int parseintarg( int argcount, char *args[], char *string, int *result)
   if ((i = findoption( argcount, args, string)) > 0)
    {
       switch (sscanf(args[i] + 1 + strlen( string),
-                    "%d%c", &temp, &c))
+                    "%30d%1c", &temp, &c))
       {
        case 0: case EOF: case 2:
             argerrornum(args[i]+1, ME_NOINT);
@@ -510,7 +510,7 @@ int parsedoublearg( int argcount, char *args[], char *string, double *result)
 
   if ((i = findoption( argcount, args, string)) > 0)
     {
-      switch (sscanf(args[i] + 1 + strlen( string), "%lf%c", &temp, &end))
+      switch (sscanf(args[i] + 1 + strlen( string), "%30lf%1c", &temp, &end))
        {
        case 0: case EOF: case 2:
          argerrornum(args[i]+1, ME_NODOUBLE);
@@ -545,7 +545,7 @@ int parsevolarg( int argcount, char *args[], char *string, double *result)
   if ((i = findoption( argcount, args, string)) > 0)
     {
       switch (sscanf(args[i] + 1 + strlen( string),
-                    "%lf%c%c%c", &vol, &sbd, &sbb, &end))
+                    "%30lf%1c%1c%1c", &vol, &sbd, &sbb, &end))
        {
          case 0: case EOF: case 4:
          weird = TRUE;
@@ -593,7 +593,7 @@ int parsevolume(char *s, double *result)
     char sbd, sbb, end;
 
     *result = 1.0;
-    k = sscanf(s, "%lf%c%c%c", result, &sbd, &sbb, &end);
+    k = sscanf(s, "%30lf%1c%1c%1c", result, &sbd, &sbb, &end);
     switch (k)
     {
       case 0:
index 5aa7a79d78707814368f498893f5e07dcf4fa4fc..be276fdf496ecddc0a87baf11b109e76d6224bb7 100644 (file)
@@ -156,7 +156,7 @@ static int load_config(void)
                        } else if (!strcasecmp(buf, "smoothfade")) {
                                smoothfade = 1;
                        } else if (!strcasecmp(buf, "mutelevel")) {
-                               if (val && (sscanf(val, "%d", &x) == 1) && (x > -1) && (x < 101)) {
+                               if (val && (sscanf(val, "%3d", &x) == 1) && (x > -1) && (x < 101)) {
                                        mutelevel = x;
                                } else 
                                        fprintf(stderr, "mutelevel must be a number from 0 (most muted) to 100 (no mute) at line %d\n", lineno);
@@ -216,7 +216,7 @@ static int connect_asterisk(void)
        if (ports) {
                *ports = '\0';
                ports++;
-               if ((sscanf(ports, "%d", &port) != 1) || (port < 1) || (port > 65535)) {
+               if ((sscanf(ports, "%5d", &port) != 1) || (port < 1) || (port > 65535)) {
                        fprintf(stderr, "'%s' is not a valid port number in the hostname\n", ports);
                        return -1;
                }