Index: channel.c =================================================================== --- channel.c (revision 211525) +++ channel.c (revision 211526) @@ -3875,9 +3875,9 @@ c = copy; while((piece = strsep(&c, ","))) { - if (sscanf(piece, "%d-%d", &start, &finish) == 2) { + if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) { /* Range */ - } else if (sscanf(piece, "%d", &start)) { + } else if (sscanf(piece, "%30d", &start)) { /* Just one */ finish = start; } else { Index: cdr.c =================================================================== --- cdr.c (revision 211525) +++ cdr.c (revision 211526) @@ -1193,7 +1193,7 @@ batchsafeshutdown = ast_true(batchsafeshutdown_value); } if ((size_value = ast_variable_retrieve(config, "general", "size"))) { - if (sscanf(size_value, "%d", &cfg_size) < 1) + if (sscanf(size_value, "%30d", &cfg_size) < 1) ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", size_value); else if (size_value < 0) ast_log(LOG_WARNING, "Invalid maximum batch size '%d' specified, using default\n", cfg_size); @@ -1201,7 +1201,7 @@ batchsize = cfg_size; } if ((time_value = ast_variable_retrieve(config, "general", "time"))) { - if (sscanf(time_value, "%d", &cfg_time) < 1) + if (sscanf(time_value, "%30d", &cfg_time) < 1) ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", time_value); else if (time_value < 0) ast_log(LOG_WARNING, "Invalid maximum batch time '%d' specified, using default\n", cfg_time); Index: pbx/pbx_config.c =================================================================== --- pbx/pbx_config.c (revision 211525) +++ pbx/pbx_config.c (revision 211526) @@ -1192,7 +1192,7 @@ if (!strcmp(prior, "hint")) { iprior = PRIORITY_HINT; } else { - if (sscanf(prior, "%d", &iprior) != 1) { + if (sscanf(prior, "%30d", &iprior) != 1) { ast_cli(fd, "'%s' is not a valid priority\n", prior); prior = NULL; } @@ -1708,7 +1708,7 @@ else ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n"); } else { - if (sscanf(pri, "%d", &ipri) != 1) { + if (sscanf(pri, "%30d", &ipri) != 1) { if ((ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) { ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno); ipri = 0; Index: pbx/pbx_loopback.c =================================================================== --- pbx/pbx_loopback.c (revision 211525) +++ pbx/pbx_loopback.c (revision 211526) @@ -126,7 +126,7 @@ 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: pbx/pbx_spool.c =================================================================== --- pbx/pbx_spool.c (revision 211525) +++ pbx/pbx_spool.c (revision 211526) @@ -168,7 +168,7 @@ } else if (!strcasecmp(buf, "data")) { strncpy(o->data, c, sizeof(o->data) - 1); } else if (!strcasecmp(buf, "maxretries")) { - if (sscanf(c, "%d", &o->maxretries) != 1) { + if (sscanf(c, "%30d", &o->maxretries) != 1) { ast_log(LOG_WARNING, "Invalid max retries at line %d of %s\n", lineno, fn); o->maxretries = 0; } @@ -177,24 +177,24 @@ } else if (!strcasecmp(buf, "extension")) { strncpy(o->exten, c, sizeof(o->exten) - 1); } else if (!strcasecmp(buf, "priority")) { - if ((sscanf(c, "%d", &o->priority) != 1) || (o->priority < 1)) { + if ((sscanf(c, "%30d", &o->priority) != 1) || (o->priority < 1)) { ast_log(LOG_WARNING, "Invalid priority at line %d of %s\n", lineno, fn); o->priority = 1; } } else if (!strcasecmp(buf, "retrytime")) { - if ((sscanf(c, "%d", &o->retrytime) != 1) || (o->retrytime < 1)) { + if ((sscanf(c, "%30d", &o->retrytime) != 1) || (o->retrytime < 1)) { ast_log(LOG_WARNING, "Invalid retrytime at line %d of %s\n", lineno, fn); o->retrytime = 300; } } else if (!strcasecmp(buf, "waittime")) { - if ((sscanf(c, "%d", &o->waittime) != 1) || (o->waittime < 1)) { + if ((sscanf(c, "%30d", &o->waittime) != 1) || (o->waittime < 1)) { ast_log(LOG_WARNING, "Invalid retrytime at line %d of %s\n", lineno, fn); o->waittime = 45; } } else if (!strcasecmp(buf, "retry")) { o->retries++; } else if (!strcasecmp(buf, "startretry")) { - if (sscanf(c, "%d", &o->callingpid) != 1) { + if (sscanf(c, "%30d", &o->callingpid) != 1) { ast_log(LOG_WARNING, "Unable to retrieve calling PID!\n"); o->callingpid = 0; } Index: pbx/pbx_dundi.c =================================================================== --- pbx/pbx_dundi.c (revision 211525) +++ pbx/pbx_dundi.c (revision 211526) @@ -1155,12 +1155,12 @@ /* Build request string */ if (!ast_db_get("dundi/cache", key, data, sizeof(data))) { ptr = data; - if (sscanf(ptr, "%d|%n", (int *)&timeout, &length) == 1) { + if (sscanf(ptr, "%30d|%n", (int *)&timeout, &length) == 1) { expiration = timeout - now; if (expiration > 0) { ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", (int)(timeout - now)); ptr += length; - while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) { + while((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) == 3)) { ptr += length; term = strchr(ptr, '|'); if (term) { @@ -2050,7 +2050,7 @@ time_t expired; ast_db_get(secretpath, "secretexpiry", tmp, sizeof(tmp)); - if (sscanf(tmp, "%d", (int *)&expired) == 1) { + if (sscanf(tmp, "%30d", (int *)&expired) == 1) { ast_db_get(secretpath, "secret", tmp, sizeof(tmp)); current = strchr(tmp, ';'); if (!current) @@ -4169,7 +4169,7 @@ } else if (x >= 4) { ast_copy_string(map->dcontext, name, sizeof(map->dcontext)); ast_copy_string(map->lcontext, fields[0], sizeof(map->lcontext)); - if ((sscanf(fields[1], "%d", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) { + if ((sscanf(fields[1], "%30d", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) { ast_copy_string(map->dest, fields[3], sizeof(map->dest)); if ((map->tech = str2tech(fields[2]))) { map->dead = 0; @@ -4272,7 +4272,7 @@ if (c) { *c = '\0'; c++; - if (sscanf(c, "%d:%d", &port, &expire) == 2) { + if (sscanf(c, "%30d:%30d", &port, &expire) == 2) { /* Got it! */ inet_aton(data, &peer->addr.sin_addr); peer->addr.sin_family = AF_INET; @@ -4377,7 +4377,7 @@ peer->maxms = 0; } else if (!strcasecmp(v->value, "yes")) { peer->maxms = DEFAULT_MAXMS; - } else if (sscanf(v->value, "%d", &peer->maxms) != 1) { + } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) { ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of dundi.conf\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid), v->lineno); peer->maxms = 0; @@ -4613,14 +4613,14 @@ } else if (!strcasecmp(v->name, "authdebug")) { authdebug = ast_true(v->value); } else if (!strcasecmp(v->name, "ttl")) { - if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) { + if ((sscanf(v->value, "%30d", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) { dundi_ttl = x; } else { ast_log(LOG_WARNING, "'%s' is not a valid TTL at line %d, must be number from 1 to %d\n", v->value, v->lineno, DUNDI_DEFAULT_TTL); } } else if (!strcasecmp(v->name, "autokill")) { - if (sscanf(v->value, "%d", &x) == 1) { + if (sscanf(v->value, "%30d", &x) == 1) { if (x >= 0) global_autokilltimeout = x; else @@ -4636,7 +4636,7 @@ else ast_log(LOG_WARNING, "Invalid global endpoint identifier '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%d", &format) == 1) + if (sscanf(v->value, "%30d", &format) == 1) tos = format & 0xff; else if (!strcasecmp(v->value, "lowdelay")) tos = IPTOS_LOWDELAY; @@ -4673,7 +4673,7 @@ } 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: pbx/dundi-parser.c =================================================================== --- pbx/dundi-parser.c (revision 211525) +++ pbx/dundi-parser.c (revision 211526) @@ -91,7 +91,7 @@ { 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: channels/misdn_config.c =================================================================== --- channels/misdn_config.c (revision 211525) +++ channels/misdn_config.c (revision 211526) @@ -556,9 +556,9 @@ { char *pat; if (strchr(value,'x')) - pat="%x"; + pat="%30x"; else - pat="%d"; + pat="%30d"; if (sscanf(value, pat, &tmp)) { dest->num = (int *)malloc(sizeof(int)); memcpy(dest->num, &tmp, sizeof(int)); @@ -572,7 +572,7 @@ break; case MISDN_CTYPE_BOOLINT: dest->num = (int *)malloc(sizeof(int)); - if (sscanf(value, "%d", &tmp)) { + if (sscanf(value, "%30d", &tmp)) { memcpy(dest->num, &tmp, sizeof(int)); } else { *(dest->num) = (ast_true(value) ? boolint_def : 0); @@ -639,7 +639,7 @@ for (token = strsep(&v->value, ","); token; token = strsep(&v->value, ","), *ptpbuf = 0) { if (!*token) continue; - if (sscanf(token, "%d-%d%s", &start, &end, ptpbuf) >= 2) { + if (sscanf(token, "%30d-%30d%511s", &start, &end, ptpbuf) >= 2) { for (; start <= end; start++) { if (start <= max_ports && start > 0) { cfg_for_ports[start] = 1; @@ -648,7 +648,7 @@ CLI_ERROR(v->name, v->value, cat); } } else { - if (sscanf(token, "%d%s", &start, ptpbuf)) { + if (sscanf(token, "%30d%511s", &start, ptpbuf)) { if (start <= max_ports && start > 0) { cfg_for_ports[start] = 1; ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0; Index: channels/chan_phone.c =================================================================== --- channels/chan_phone.c (revision 211525) +++ channels/chan_phone.c (revision 211526) @@ -1216,7 +1216,7 @@ 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: channels/chan_h323.c =================================================================== --- channels/chan_h323.c (revision 211525) +++ channels/chan_h323.c (revision 211526) @@ -2037,7 +2037,7 @@ 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: channels/chan_zap.c =================================================================== --- channels/chan_zap.c (revision 211525) +++ channels/chan_zap.c (revision 211526) @@ -7666,7 +7666,7 @@ char *stringp=NULL; stringp=dest + 1; s = strsep(&stringp, "/"); - if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) { + if ((res = sscanf(s, "%30d%c%30d", &x, &opt, &y)) < 1) { ast_log(LOG_WARNING, "Unable to determine group for data %s\n", (char *)data); return NULL; } @@ -7701,7 +7701,7 @@ channelmatch = x; } #ifdef ZAPATA_PRI - else if ((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) > 1) { + else if ((res = sscanf(s, "%30d:%30d%c%30d", &trunkgroup, &crv, &opt, &y)) > 1) { if ((trunkgroup < 1) || (crv < 1)) { ast_log(LOG_WARNING, "Unable to determine trunk group and CRV for data %s\n", (char *)data); return NULL; @@ -7724,7 +7724,7 @@ p = pris[x].crvs; } #endif - else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) { + else if ((res = sscanf(s, "%30d%c%30d", &x, &opt, &y)) < 1) { ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data); return NULL; } else { @@ -9797,7 +9797,7 @@ return RESULT_SHOWUSAGE; #ifdef ZAPATA_PRI if ((c = strchr(argv[3], ':'))) { - if (sscanf(argv[3], "%d:%d", &trunkgroup, &channel) != 2) + if (sscanf(argv[3], "%30d:%30d", &trunkgroup, &channel) != 2) return RESULT_SHOWUSAGE; if ((trunkgroup < 1) || (channel < 1)) return RESULT_SHOWUSAGE; @@ -10423,7 +10423,7 @@ #ifdef ZAPATA_PRI pri = NULL; if (!strcasecmp(v->name, "crv")) { - if (sscanf(c, "%d:%n", &trunkgroup, &y) != 1) { + if (sscanf(c, "%30d:%n", &trunkgroup, &y) != 1) { ast_log(LOG_WARNING, "CRV must begin with trunkgroup followed by a colon at line %d\n", v->lineno); ast_config_destroy(cfg); ast_mutex_unlock(&iflock); @@ -10452,9 +10452,9 @@ #endif chan = strsep(&c, ","); while(chan) { - if (sscanf(chan, "%d-%d", &start, &finish) == 2) { + if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) { /* Range */ - } else if (sscanf(chan, "%d", &start)) { + } else if (sscanf(chan, "%30d", &start)) { /* Just one */ finish = start; } else if (!strcasecmp(chan, "pseudo")) { @@ -10511,13 +10511,13 @@ ast_copy_string(drings.ringContext[2].contextData,v->value,sizeof(drings.ringContext[2].contextData)); } else if (!strcasecmp(v->name, "dring1")) { ringc = v->value; - sscanf(ringc, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]); + sscanf(ringc, "%30d,%30d,%30d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]); } else if (!strcasecmp(v->name, "dring2")) { ringc = v->value; - sscanf(ringc,"%d,%d,%d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]); + sscanf(ringc,"%30d,%30d,%30d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]); } else if (!strcasecmp(v->name, "dring3")) { ringc = v->value; - sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]); + sscanf(ringc, "%30d,%30d,%30d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]); } else if (!strcasecmp(v->name, "usecallerid")) { chan_conf.use_callerid = ast_true(v->value); } else if (!strcasecmp(v->name, "cidsignalling")) { @@ -10560,7 +10560,7 @@ } else if (!strcasecmp(v->name, "busycount")) { chan_conf.busycount = atoi(v->value); } else if (!strcasecmp(v->name, "busypattern")) { - if (sscanf(v->value, "%d,%d", &chan_conf.busy_tonelength, &chan_conf.busy_quietlength) != 2) { + if (sscanf(v->value, "%30d,%30d", &chan_conf.busy_tonelength, &chan_conf.busy_quietlength) != 2) { ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength\n"); } } else if (!strcasecmp(v->name, "callprogress")) { @@ -10592,7 +10592,7 @@ chan_conf.echocancel=128; } } else if (!strcasecmp(v->name, "echotraining")) { - if (sscanf(v->value, "%d", &y) == 1) { + if (sscanf(v->value, "%30d", &y) == 1) { if ((y < 10) || (y > 4000)) { ast_log(LOG_WARNING, "Echo training time must be within the range of 10 to 2000 ms at line %d\n", v->lineno); } else { @@ -10635,15 +10635,15 @@ } else if (!strcasecmp(v->name, "transfertobusy")) { chan_conf.transfertobusy = ast_true(v->value); } else if (!strcasecmp(v->name, "rxgain")) { - if (sscanf(v->value, "%f", &chan_conf.rxgain) != 1) { + if (sscanf(v->value, "%30f", &chan_conf.rxgain) != 1) { ast_log(LOG_WARNING, "Invalid rxgain: %s\n", v->value); } } else if (!strcasecmp(v->name, "txgain")) { - if (sscanf(v->value, "%f", &chan_conf.txgain) != 1) { + if (sscanf(v->value, "%30f", &chan_conf.txgain) != 1) { ast_log(LOG_WARNING, "Invalid txgain: %s\n", v->value); } } else if (!strcasecmp(v->name, "tonezone")) { - if (sscanf(v->value, "%d", &chan_conf.tonezone) != 1) { + if (sscanf(v->value, "%30d", &chan_conf.tonezone) != 1) { ast_log(LOG_WARNING, "Invalid tonezone: %s\n", v->value); } } else if (!strcasecmp(v->name, "callerid")) { @@ -10944,7 +10944,7 @@ 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: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 211525) +++ channels/chan_sip.c (revision 211526) @@ -2095,7 +2095,7 @@ res = 0; ast_set_flag(p, SIP_OUTGOING); #ifdef OSP_SUPPORT - if (!p->options->osptoken || !osphandle || (sscanf(osphandle, "%d", &p->osphandle) != 1)) { + if (!p->options->osptoken || !osphandle || (sscanf(osphandle, "%30d", &p->osphandle) != 1)) { /* Force Disable OSP support */ ast_log(LOG_DEBUG, "Disabling OSP support for this call. osptoken = %s, osphandle = %s\n", p->options->osptoken, osphandle); p->options->osptoken = NULL; @@ -3638,15 +3638,15 @@ ast_set_flag(p, SIP_NOVIDEO); while ((m = get_sdp_iterate(&iterator, req, "m"))[0] != '\0') { int found = 0; - if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &y, &len) == 2) || - (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) { + if ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &y, &len) == 2) || + (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1)) { found = 1; portno = x; /* Scan through the RTP payload types specified in a "m=" line: */ ast_rtp_pt_clear(p->rtp); codecs = m + len; while(!ast_strlen_zero(codecs)) { - if (sscanf(codecs, "%d%n", &codec, &len) != 1) { + if (sscanf(codecs, "%30d%n", &codec, &len) != 1) { ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs); return -1; } @@ -3659,14 +3659,14 @@ if (p->vrtp) ast_rtp_pt_clear(p->vrtp); /* Must be cleared in case no m=video line exists */ - if (p->vrtp && (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) { + if (p->vrtp && (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1)) { found = 1; ast_clear_flag(p, SIP_NOVIDEO); vportno = x; /* Scan through the RTP payload types specified in a "m=" line: */ codecs = m + len; while(!ast_strlen_zero(codecs)) { - if (sscanf(codecs, "%d%n", &codec, &len) != 1) { + if (sscanf(codecs, "%30d%n", &codec, &len) != 1) { ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs); return -1; } @@ -3747,7 +3747,7 @@ if (!strcasecmp(a, "sendrecv")) { sendonly = 0; } - if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue; + if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) != 2) continue; if (debug) ast_verbose("Found description format %s\n", mimeSubtype); /* Note: should really look at the 'freq' and '#chans' params too */ @@ -4324,7 +4324,7 @@ struct sip_request resp; int seqno = 0; - if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) { + if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) { ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq")); return -1; } @@ -4443,7 +4443,7 @@ char tmp[512]; int seqno = 0; - if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) { + if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) { ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq")); return -1; } @@ -4755,7 +4755,7 @@ { struct sip_request resp; int seqno; - if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) { + if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) { ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq")); return -1; } @@ -6078,7 +6078,7 @@ char *ptr; if ((ptr = strchr(expires, ';'))) *ptr = '\0'; - if (sscanf(expires + 9, "%d", &expiry) != 1) + if (sscanf(expires + 9, "%30d", &expiry) != 1) expiry = default_expiry; } else { /* Nothing has been specified */ @@ -10103,7 +10103,7 @@ } tmptmp = strcasestr(contact, "expires="); if (tmptmp) { - if (sscanf(tmptmp + 8, "%d;", &expires) != 1) + if (sscanf(tmptmp + 8, "%30d;", &expires) != 1) expires = 0; } @@ -11430,7 +11430,7 @@ ast_log(LOG_ERROR, "Missing Cseq. Dropping this SIP message, it's incomplete.\n"); error = 1; } - if (!error && sscanf(cseq, "%d%n", &seqno, &len) != 1) { + if (!error && sscanf(cseq, "%30d%n", &seqno, &len) != 1) { ast_log(LOG_ERROR, "No seqno in '%s'. Dropping incomplete message.\n", cmd); error = 1; } @@ -11465,7 +11465,7 @@ ignore=1; } else if (e) { e = ast_skip_blanks(e); - if (sscanf(e, "%d %n", &respid, &len) != 1) { + if (sscanf(e, "%30d %n", &respid, &len) != 1) { ast_log(LOG_WARNING, "Invalid response: '%s'\n", e); } else { /* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */ @@ -12659,7 +12659,7 @@ } if (realtime && !strcasecmp(v->name, "regseconds")) { - if (sscanf(v->value, "%ld", (time_t *)®seconds) != 1) + if (sscanf(v->value, "%30ld", (time_t *)®seconds) != 1) regseconds = 0; } else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) { inet_aton(v->value, &(peer->addr.sin_addr)); @@ -12774,17 +12774,17 @@ } else if (!strcasecmp(v->name, "disallow")) { ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, 0); } else if (!strcasecmp(v->name, "rtptimeout")) { - if ((sscanf(v->value, "%d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) { + if ((sscanf(v->value, "%30d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); peer->rtptimeout = global_rtptimeout; } } else if (!strcasecmp(v->name, "rtpholdtimeout")) { - if ((sscanf(v->value, "%d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) { + if ((sscanf(v->value, "%30d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); peer->rtpholdtimeout = global_rtpholdtimeout; } } else if (!strcasecmp(v->name, "rtpkeepalive")) { - if ((sscanf(v->value, "%d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) { + if ((sscanf(v->value, "%30d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno); peer->rtpkeepalive = global_rtpkeepalive; } @@ -12804,7 +12804,7 @@ peer->maxms = 0; } else if (!strcasecmp(v->value, "yes")) { peer->maxms = DEFAULT_MAXMS; - } else if (sscanf(v->value, "%d", &peer->maxms) != 1) { + } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) { ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno); peer->maxms = 0; } @@ -12952,24 +12952,24 @@ } else if (!strcasecmp(v->name, "relaxdtmf")) { relaxdtmf = ast_true(v->value); } else if (!strcasecmp(v->name, "checkmwi")) { - if ((sscanf(v->value, "%d", &global_mwitime) != 1) || (global_mwitime < 0)) { + if ((sscanf(v->value, "%30d", &global_mwitime) != 1) || (global_mwitime < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid MWI time setting at line %d. Using default (10).\n", v->value, v->lineno); global_mwitime = DEFAULT_MWITIME; } } else if (!strcasecmp(v->name, "vmexten")) { ast_copy_string(global_vmexten, v->value, sizeof(global_vmexten)); } else if (!strcasecmp(v->name, "rtptimeout")) { - if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + if ((sscanf(v->value, "%30d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); global_rtptimeout = 0; } } else if (!strcasecmp(v->name, "rtpholdtimeout")) { - if ((sscanf(v->value, "%d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) { + if ((sscanf(v->value, "%30d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); global_rtpholdtimeout = 0; } } else if (!strcasecmp(v->name, "rtpkeepalive")) { - if ((sscanf(v->value, "%d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) { + if ((sscanf(v->value, "%30d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno); global_rtpkeepalive = 0; } @@ -13001,7 +13001,7 @@ ast_log(LOG_WARNING, "Unable to locate host '%s'\n", v->value); } else if (!strcasecmp(v->name, "outboundproxyport")) { /* Port needs to be after IP */ - sscanf(v->value, "%d", &format); + sscanf(v->value, "%30d", &format); outboundproxyip.sin_port = htons(format); } else if (!strcasecmp(v->name, "autocreatepeer")) { autocreatepeer = ast_true(v->value); @@ -13058,7 +13058,7 @@ memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr)); time(&externexpire); } else if (!strcasecmp(v->name, "externrefresh")) { - if (sscanf(v->value, "%d", &externrefresh) != 1) { + if (sscanf(v->value, "%30d", &externrefresh) != 1) { ast_log(LOG_WARNING, "Invalid externrefresh value '%s', must be an integer >0 at line %d\n", v->value, v->lineno); externrefresh = 10; } @@ -13089,7 +13089,7 @@ if (ast_str2tos(v->value, &tos)) ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno); } else if (!strcasecmp(v->name, "bindport")) { - if (sscanf(v->value, "%d", &ourport) == 1) { + if (sscanf(v->value, "%30d", &ourport) == 1) { bindaddr.sin_port = htons(ourport); } else { ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config); @@ -13099,7 +13099,7 @@ default_qualify = 0; } else if (!strcasecmp(v->value, "yes")) { default_qualify = DEFAULT_MAXMS; - } else if (sscanf(v->value, "%d", &default_qualify) != 1) { + } else if (sscanf(v->value, "%30d", &default_qualify) != 1) { ast_log(LOG_WARNING, "Qualification default should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", v->lineno); default_qualify = 0; } @@ -13531,7 +13531,7 @@ memset(lport, 0, sizeof(lport)); localtmp++; /* This is okey because lhost and lport are as big as tmp */ - sscanf(localtmp, "%[^<>:; ]:%[^<>:; ]", lhost, lport); + sscanf(localtmp, "%80[^<>:; ]:%80[^<>:; ]", lhost, lport); if (!strlen(lhost)) { ast_log(LOG_ERROR, "Can't find the host address\n"); return 0; Index: channels/chan_agent.c =================================================================== --- channels/chan_agent.c (revision 211525) +++ channels/chan_agent.c (revision 211526) @@ -1296,9 +1296,9 @@ struct timeval tv; s = data; - if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) { + if ((s[0] == '@') && (sscanf(s + 1, "%30d", &groupoff) == 1)) { groupmatch = (1 << groupoff); - } else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) { + } else if ((s[0] == ':') && (sscanf(s + 1, "%30d", &groupoff) == 1)) { groupmatch = (1 << groupoff); waitforagent = 1; } else { @@ -2405,9 +2405,9 @@ 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: channels/iax2-provision.c =================================================================== --- channels/iax2-provision.c (revision 211525) +++ channels/iax2-provision.c (revision 211526) @@ -242,7 +242,7 @@ ast_mutex_lock(&provlock); ast_db_get("iax/provisioning/cache", template, tmp, sizeof(tmp)); - if (sscanf(tmp, "v%x", version) != 1) { + if (sscanf(tmp, "v%30x", version) != 1) { if (strcmp(tmp, "u")) { ret = iax_provision_build(&ied, version, template, force); if (ret) @@ -301,7 +301,7 @@ v = ast_variable_browse(cfg, s); while(v) { if (!strcasecmp(v->name, "port") || !strcasecmp(v->name, "serverport")) { - if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < 65535)) { + if ((sscanf(v->value, "%5d", &x) == 1) && (x > 0) && (x < 65535)) { if (!strcasecmp(v->name, "port")) { cur->port = x; foundportno = 1; @@ -327,7 +327,7 @@ } else ast_log(LOG_WARNING, "Ignoring invalid codec '%s' for '%s' at line %d\n", v->value, s, v->lineno); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%d", &x) == 1) + if (sscanf(v->value, "%3d", &x) == 1) cur->tos = x & 0xff; else if (!strcasecmp(v->value, "lowdelay")) cur->tos = IPTOS_LOWDELAY; Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 211525) +++ channels/chan_iax2.c (revision 211526) @@ -2814,7 +2814,7 @@ break; } } else if (!strcasecmp(tmp->name, "regseconds")) { - if (sscanf(tmp->value, "%ld", (time_t *)®seconds) != 1) + if (sscanf(tmp->value, "%30ld", (time_t *)®seconds) != 1) regseconds = 0; } else if (!strcasecmp(tmp->name, "ipaddr")) { inet_aton(tmp->value, &(peer->addr.sin_addr)); @@ -8787,18 +8787,18 @@ peer->maxms = 0; } else if (!strcasecmp(v->value, "yes")) { peer->maxms = DEFAULT_MAXMS; - } else if (sscanf(v->value, "%d", &peer->maxms) != 1) { + } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) { ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno); peer->maxms = 0; } } else if (!strcasecmp(v->name, "qualifysmoothing")) { peer->smoothing = ast_true(v->value); } else if (!strcasecmp(v->name, "qualifyfreqok")) { - if (sscanf(v->value, "%d", &peer->pokefreqok) != 1) { + if (sscanf(v->value, "%30d", &peer->pokefreqok) != 1) { ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when OK should a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno); } } else if (!strcasecmp(v->name, "qualifyfreqnotok")) { - if (sscanf(v->value, "%d", &peer->pokefreqnotok) != 1) { + if (sscanf(v->value, "%30d", &peer->pokefreqnotok) != 1) { ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when NOT OK should be a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno); } else ast_log(LOG_WARNING, "Set peer->pokefreqnotok to %d\n", peer->pokefreqnotok); } else if (!strcasecmp(v->name, "timezone")) { @@ -9272,7 +9272,7 @@ 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: channels/chan_misdn.c =================================================================== --- channels/chan_misdn.c (revision 211525) +++ channels/chan_misdn.c (revision 211526) @@ -787,7 +787,7 @@ int onlyport = -1; if (argc >= 4) { - if (!sscanf(argv[3], "%d", &onlyport) || onlyport < 0) { + if (!sscanf(argv[3], "%30d", &onlyport) || onlyport < 0) { ast_cli(fd, "Unknown option: %s\n", argv[3]); return RESULT_SHOWUSAGE; } Index: channels/chan_skinny.c =================================================================== --- channels/chan_skinny.c (revision 211525) +++ channels/chan_skinny.c (revision 211526) @@ -3125,7 +3125,7 @@ capability &= ~format; } } else if (!strcasecmp(v->name, "port")) { - if (sscanf(v->value, "%d", &ourport) == 1) { + if (sscanf(v->value, "%30d", &ourport) == 1) { bindaddr.sin_port = htons(ourport); } else { ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config); Index: channels/chan_mgcp.c =================================================================== --- channels/chan_mgcp.c (revision 211525) +++ channels/chan_mgcp.c (revision 211526) @@ -1793,7 +1793,7 @@ ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c); return -1; } - if (sscanf(m, "audio %d RTP/AVP %n", &portno, &len) != 1) { + if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1) { ast_log(LOG_WARNING, "Unable to determine port number for RTP in '%s'\n", m); return -1; } @@ -1808,7 +1808,7 @@ ast_rtp_pt_clear(sub->rtp); codecs = ast_strdupa(m + len); while (!ast_strlen_zero(codecs)) { - if (sscanf(codecs, "%d%n", &codec, &len) != 1) { + if (sscanf(codecs, "%30d%n", &codec, &len) != 1) { if (codec_count) break; ast_log(LOG_WARNING, "Error in codec string '%s' at '%s'\n", m, codecs); @@ -1824,7 +1824,7 @@ sdpLineNum_iterator_init(&iterator); while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') { char* mimeSubtype = ast_strdupa(a); /* ensures we have enough space */ - if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) + if (sscanf(a, "rtpmap: %30u %[^/]/", &codec, mimeSubtype) != 2) continue; /* Note: should really look at the 'freq' and '#chans' params too */ ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype); @@ -1958,7 +1958,7 @@ if (mgr) { /* Store MGCP response in case we have to retransmit */ memset(mgr, 0, sizeof(struct mgcp_response)); - sscanf(req->identifier, "%d", &mgr->seqno); + sscanf(req->identifier, "%30d", &mgr->seqno); time(&mgr->whensent); mgr->len = resp.len; memcpy(mgr->buf, resp.data, resp.len); @@ -3246,7 +3246,7 @@ time_t now; struct mgcp_response *prev = NULL, *cur, *next, *answer=NULL; time(&now); - if (sscanf(req->identifier, "%d", &seqno) != 1) + if (sscanf(req->identifier, "%30d", &seqno) != 1) seqno = 0; cur = sub->parent->parent->responses; while(cur) { @@ -3305,7 +3305,7 @@ return 1; } - if (sscanf(req.verb, "%d", &result) && sscanf(req.identifier, "%d", &ident)) { + if (sscanf(req.verb, "%30d", &result) && sscanf(req.identifier, "%30d", &ident)) { /* Try to find who this message is for, if it's important */ sub = find_subchannel_and_lock(NULL, ident, &sin); if (sub) { @@ -4119,7 +4119,7 @@ else capability &= ~format; } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%d", &format) == 1) + if (sscanf(v->value, "%30d", &format) == 1) tos = format & 0xff; else if (!strcasecmp(v->value, "lowdelay")) tos = IPTOS_LOWDELAY; @@ -4134,7 +4134,7 @@ 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: channels/chan_vpb.c =================================================================== --- channels/chan_vpb.c (revision 211525) +++ channels/chan_vpb.c (revision 211526) @@ -2758,7 +2758,7 @@ float gain; /* try to scan number */ - if (sscanf(value, "%f", &gain) != 1) + if (sscanf(value, "%30f", &gain) != 1) { ast_log(LOG_ERROR, "Invalid %s value '%s' in '%s' config\n", value, gain_type, config); return DEFAULT_GAIN; Index: channels/chan_modem.c =================================================================== --- channels/chan_modem.c (revision 211525) +++ channels/chan_modem.c (revision 211526) @@ -835,7 +835,7 @@ if (dev[0]=='g' && isdigit(dev[1])) { /* Retrieve the group number */ - if (sscanf(dev+1, "%u", &groupint) < 1) { + if (sscanf(dev+1, "%30u", &groupint) < 1) { ast_log(LOG_WARNING, "Unable to determine group from [%s]\n", (char *)data); return NULL; } @@ -898,9 +898,9 @@ stringp=copy; piece = strsep(&stringp, ","); while(piece) { - if (sscanf(piece, "%d-%d", &start, &finish) == 2) { + if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) { /* Range */ - } else if (sscanf(piece, "%d", &start)) { + } else if (sscanf(piece, "%30d", &start)) { /* Just one */ finish = start; } else { Index: manager.c =================================================================== --- manager.c (revision 211525) +++ manager.c (revision 211526) @@ -870,7 +870,7 @@ astman_send_error(s, m, "Channel not specified"); return 0; } - if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) { + if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) { astman_send_error(s, m, "Invalid priority\n"); return 0; } @@ -1027,11 +1027,11 @@ astman_send_error(s, m, "Channel not specified"); return 0; } - if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) { + if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) { astman_send_error(s, m, "Invalid priority\n"); return 0; } - if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%d", &to) != 1)) { + if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%30d", &to) != 1)) { astman_send_error(s, m, "Invalid timeout\n"); return 0; } @@ -1696,12 +1696,12 @@ block_sockets = ast_true(val); if ((val = ast_variable_retrieve(cfg, "general", "port"))) { - if (sscanf(val, "%d", &portno) != 1) { + if (sscanf(val, "%5d", &portno) != 1) { ast_log(LOG_WARNING, "Invalid port number '%s'\n", val); portno = DEFAULT_MANAGER_PORT; } } else if ((val = ast_variable_retrieve(cfg, "general", "portno"))) { - if (sscanf(val, "%d", &portno) != 1) { + if (sscanf(val, "%5d", &portno) != 1) { ast_log(LOG_WARNING, "Invalid port number '%s'\n", val); portno = DEFAULT_MANAGER_PORT; } Index: apps/app_chanspy.c =================================================================== --- apps/app_chanspy.c (revision 211525) +++ apps/app_chanspy.c (revision 211526) @@ -426,7 +426,7 @@ 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: apps/app_groupcount.c =================================================================== --- apps/app_groupcount.c (revision 211525) +++ apps/app_groupcount.c (revision 211526) @@ -180,7 +180,7 @@ ast_app_group_split_group(args.max, limit, sizeof(limit), category, sizeof(category)); - if ((sscanf(limit, "%d", &max) == 1) && (max > -1)) { + if ((sscanf(limit, "%30d", &max) == 1) && (max > -1)) { count = ast_app_group_get_count(pbx_builtin_getvar_helper(chan, category), category); if (count > max) { pbx_builtin_setvar_helper(chan, "CHECKGROUPSTATUS", "OVERMAX"); Index: apps/app_adsiprog.c =================================================================== --- apps/app_adsiprog.c (revision 211525) +++ apps/app_adsiprog.c (revision 211526) @@ -194,7 +194,7 @@ if (!(argtype & ARG_NUMBER)) return -1; /* Octal value */ - if (sscanf(src, "%o", (int *)out) != 1) + if (sscanf(src, "%30o", (int *)out) != 1) return -1; if (argtype & ARG_STRING) { /* Convert */ @@ -204,7 +204,7 @@ if (!(argtype & ARG_NUMBER)) return -1; /* Hex value */ - if (sscanf(src + 2, "%x", (unsigned int *)out) != 1) + if (sscanf(src + 2, "%30x", (unsigned int *)out) != 1) return -1; if (argtype & ARG_STRING) { /* Convert */ @@ -214,7 +214,7 @@ 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: apps/app_alarmreceiver.c =================================================================== --- apps/app_alarmreceiver.c (revision 211525) +++ apps/app_alarmreceiver.c (revision 211526) @@ -134,7 +134,7 @@ return; } - sscanf(value, "%u", &v); + sscanf(value, "%30u", &v); v++; if(option_verbose >= 4) Index: apps/app_talkdetect.c =================================================================== --- apps/app_talkdetect.c (revision 211525) +++ apps/app_talkdetect.c (revision 211526) @@ -97,15 +97,15 @@ 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: apps/app_math.c =================================================================== --- apps/app_math.c (revision 211525) +++ apps/app_math.c (revision 211526) @@ -181,13 +181,13 @@ return -1; } - if (sscanf(mvalue1, "%f", &fnum1) != 1) { + if (sscanf(mvalue1, "%30f", &fnum1) != 1) { ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue1); LOCAL_USER_REMOVE(u); return -1; } - if (sscanf(mvalue2, "%f", &fnum2) != 1) { + if (sscanf(mvalue2, "%30f", &fnum2) != 1) { ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue2); LOCAL_USER_REMOVE(u); return -1; Index: apps/app_mixmonitor.c =================================================================== --- apps/app_mixmonitor.c (revision 211525) +++ apps/app_mixmonitor.c (revision 211526) @@ -336,7 +336,7 @@ if (ast_test_flag(&flags, MUXFLAG_READVOLUME)) { if (ast_strlen_zero(opts[OPT_ARG_READVOLUME])) { ast_log(LOG_WARNING, "No volume level was provided for the heard volume ('v') option.\n"); - } else if ((sscanf(opts[OPT_ARG_READVOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) { + } else if ((sscanf(opts[OPT_ARG_READVOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) { ast_log(LOG_NOTICE, "Heard volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_READVOLUME]); } else { readvol = get_volfactor(x); @@ -346,7 +346,7 @@ if (ast_test_flag(&flags, MUXFLAG_WRITEVOLUME)) { if (ast_strlen_zero(opts[OPT_ARG_WRITEVOLUME])) { ast_log(LOG_WARNING, "No volume level was provided for the spoken volume ('V') option.\n"); - } else if ((sscanf(opts[OPT_ARG_WRITEVOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) { + } else if ((sscanf(opts[OPT_ARG_WRITEVOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) { ast_log(LOG_NOTICE, "Spoken volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_WRITEVOLUME]); } else { writevol = get_volfactor(x); @@ -356,7 +356,7 @@ 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: apps/app_readfile.c =================================================================== --- apps/app_readfile.c (revision 211525) +++ apps/app_readfile.c (revision 211526) @@ -89,7 +89,7 @@ } 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: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 211525) +++ apps/app_meetme.c (revision 211526) @@ -497,7 +497,7 @@ ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno); AST_LIST_INSERT_HEAD(&confs, cnf, list); /* Reserve conference number in map */ - if ((sscanf(cnf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024)) + if ((sscanf(cnf->confno, "%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024)) conf_map[confno_int] = 1; } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -806,7 +806,7 @@ AST_LIST_LOCK(&confs); if (ast_atomic_dec_and_test(&conf->refcount)) { /* Take the conference room number out of an inuse state */ - if ((sscanf(conf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024)) + if ((sscanf(conf->confno, "%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024)) conf_map[confno_int] = 0; conf_free(conf); res = 1; @@ -862,7 +862,7 @@ /* Possible timeout waiting for marked user */ if ((confflags & CONFFLAG_WAITMARKED) && !ast_strlen_zero(optargs[OPT_ARG_WAITMARKED]) && - (sscanf(optargs[OPT_ARG_WAITMARKED], "%d", &opt_waitmarked_timeout) == 1) && + (sscanf(optargs[OPT_ARG_WAITMARKED], "%30d", &opt_waitmarked_timeout) == 1) && (opt_waitmarked_timeout > 0)) { timeout = time(NULL) + opt_waitmarked_timeout; } @@ -1901,7 +1901,7 @@ if (!res) ast_waitstream(chan, ""); } else { - if (sscanf(confno, "%d", &confno_int) == 1) { + if (sscanf(confno, "%30d", &confno_int) == 1) { res = ast_streamfile(chan, "conf-enteringno", chan->language); if (!res) { ast_waitstream(chan, ""); @@ -2020,7 +2020,7 @@ return NULL; } - sscanf(callerident, "%i", &cid); + sscanf(callerident, "%30i", &cid); AST_LIST_TRAVERSE(&conf->userlist, user, list) { if (user->user_no == cid) @@ -2179,7 +2179,7 @@ return; if ((val = ast_variable_retrieve(cfg, "general", "audiobuffers"))) { - if ((sscanf(val, "%d", &audio_buffers) != 1)) { + if ((sscanf(val, "%30d", &audio_buffers) != 1)) { ast_log(LOG_WARNING, "audiobuffers setting must be a number, not '%s'\n", val); audio_buffers = DEFAULT_AUDIO_BUFFERS; } else if ((audio_buffers < ZT_DEFAULT_NUM_BUFS) || (audio_buffers > ZT_MAX_NUM_BUFS)) { Index: apps/app_macro.c =================================================================== --- apps/app_macro.c (revision 211525) +++ apps/app_macro.c (revision 211526) @@ -169,12 +169,12 @@ /* does the user want a deeper rabbit hole? */ s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION"); if (s) - sscanf(s, "%d", &maxdepth); + sscanf(s, "%3d", &maxdepth); /* Count how many levels deep the rabbit hole goes */ tmp = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH"); if (tmp) { - sscanf(tmp, "%d", &depth); + sscanf(tmp, "%3d", &depth); } else { depth = 0; } @@ -184,7 +184,7 @@ pbx_builtin_setvar_helper(chan, "MACRO_IN_HANGUP", "1"); inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP"); if (!ast_strlen_zero(inhangupc)) - sscanf(inhangupc, "%d", &inhangup); + sscanf(inhangupc, "%3d", &inhangup); if (depth >= maxdepth) { ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n"); @@ -442,7 +442,7 @@ 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: apps/app_sms.c =================================================================== --- apps/app_sms.c (revision 211525) +++ apps/app_sms.c (revision 211526) @@ -748,7 +748,7 @@ H, M, S; - if (sscanf (p, "%d-%d-%dT%d:%d:%d", &Y, &m, &d, &H, &M, &S) == 6) + if (sscanf (p, "%4d-%2d-%2dT%2d:%2d:%2d", &Y, &m, &d, &H, &M, &S) == 6) { struct tm t; t.tm_year = Y - 1900; Index: apps/app_verbose.c =================================================================== --- apps/app_verbose.c (revision 211525) +++ apps/app_verbose.c (revision 211526) @@ -65,7 +65,7 @@ if (vtext) { char *tmp = strsep(&vtext, "|"); if (vtext) { - if (sscanf(tmp, "%d", &vsize) != 1) { + if (sscanf(tmp, "%30d", &vsize) != 1) { vsize = 0; ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext); } Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 211525) +++ apps/app_voicemail.c (revision 211526) @@ -463,7 +463,7 @@ } else if (!strcasecmp(var, "sayduration")){ ast_set2_flag(vmu, ast_true(value), VM_SAYDURATION); } else if (!strcasecmp(var, "saydurationm")){ - if (sscanf(value, "%d", &x) == 1) { + if (sscanf(value, "%30d", &x) == 1) { vmu->saydurationm = x; } else { ast_log(LOG_WARNING, "Invalid min duration for say duration\n"); @@ -1042,7 +1042,7 @@ SQLFreeHandle (SQL_HANDLE_STMT, stmt); goto yuck; } - if (sscanf(rowdata, "%d", &x) != 1) + if (sscanf(rowdata, "%30d", &x) != 1) ast_log(LOG_WARNING, "Failed to read message count!\n"); SQLFreeHandle (SQL_HANDLE_STMT, stmt); } else @@ -1096,7 +1096,7 @@ SQLFreeHandle (SQL_HANDLE_STMT, stmt); goto yuck; } - if (sscanf(rowdata, "%d", &x) != 1) + if (sscanf(rowdata, "%30d", &x) != 1) ast_log(LOG_WARNING, "Failed to read message count!\n"); SQLFreeHandle (SQL_HANDLE_STMT, stmt); } else @@ -3695,7 +3695,7 @@ time_t t; long tin; - if (sscanf(origtime,"%ld",&tin) < 1) { + if (sscanf(origtime,"%30ld",&tin) < 1) { ast_log(LOG_WARNING, "Couldn't find origtime in %s\n", filename); return 0; } @@ -5191,7 +5191,7 @@ ast_log(LOG_WARNING, "No value provided for record gain option\n"); LOCAL_USER_REMOVE(u); return -1; - } else if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) { + } else if (sscanf(opts[OPT_ARG_RECORDGAIN], "%30d", &gain) != 1) { ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]); LOCAL_USER_REMOVE(u); return -1; @@ -5633,7 +5633,7 @@ if (ast_test_flag(&flags, OPT_RECORDGAIN)) { int gain; - if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) { + if (sscanf(opts[OPT_ARG_RECORDGAIN], "%30d", &gain) != 1) { ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]); LOCAL_USER_REMOVE(u); return -1; @@ -6067,7 +6067,7 @@ vmmaxmessage = 0; if ((s = ast_variable_retrieve(cfg, "general", "maxmessage"))) { - if (sscanf(s, "%d", &x) == 1) { + if (sscanf(s, "%30d", &x) == 1) { vmmaxmessage = x; } else { ast_log(LOG_WARNING, "Invalid max message time length\n"); @@ -6076,7 +6076,7 @@ vmminmessage = 0; if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) { - if (sscanf(s, "%d", &x) == 1) { + if (sscanf(s, "%30d", &x) == 1) { vmminmessage = x; if (maxsilence <= vmminmessage) ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n"); @@ -6091,7 +6091,7 @@ skipms = 3000; if ((s = ast_variable_retrieve(cfg, "general", "maxgreet"))) { - if (sscanf(s, "%d", &x) == 1) { + if (sscanf(s, "%30d", &x) == 1) { maxgreet = x; } else { ast_log(LOG_WARNING, "Invalid max message greeting length\n"); @@ -6099,7 +6099,7 @@ } if ((s = ast_variable_retrieve(cfg, "general", "skipms"))) { - if (sscanf(s, "%d", &x) == 1) { + if (sscanf(s, "%30d", &x) == 1) { skipms = x; } else { ast_log(LOG_WARNING, "Invalid skipms value\n"); @@ -6108,7 +6108,7 @@ maxlogins = 3; if ((s = ast_variable_retrieve(cfg, "general", "maxlogins"))) { - if (sscanf(s, "%d", &x) == 1) { + if (sscanf(s, "%30d", &x) == 1) { maxlogins = x; } else { ast_log(LOG_WARNING, "Invalid max failed login attempts\n"); @@ -6178,7 +6178,7 @@ 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: apps/app_dial.c =================================================================== --- apps/app_dial.c (revision 211525) +++ apps/app_dial.c (revision 211526) @@ -1706,7 +1706,7 @@ if ((dialdata = strchr(announce, '|'))) { *dialdata = '\0'; dialdata++; - if (sscanf(dialdata, "%d", &sleep) == 1) { + if (sscanf(dialdata, "%30d", &sleep) == 1) { sleep *= 1000; } else { ast_log(LOG_ERROR, "%s requires the numerical argument \n",rapp); @@ -1716,7 +1716,7 @@ if ((dialdata = strchr(dialdata, '|'))) { *dialdata = '\0'; dialdata++; - if (sscanf(dialdata, "%d", &loops) != 1) { + if (sscanf(dialdata, "%30d", &loops) != 1) { ast_log(LOG_ERROR, "%s requires the numerical argument \n",rapp); LOCAL_USER_REMOVE(u); return -1; Index: apps/app_waitforsilence.c =================================================================== --- apps/app_waitforsilence.c (revision 211525) +++ apps/app_waitforsilence.c (revision 211526) @@ -157,8 +157,8 @@ res = ast_answer(chan); /* Answer the channel */ - if (!data || ((sscanf(data, "%d|%d", &maxsilence, &iterations) != 2) && - (sscanf(data, "%d", &maxsilence) != 1))) { + if (!data || ((sscanf(data, "%30d|%30d", &maxsilence, &iterations) != 2) && + (sscanf(data, "%30d", &maxsilence) != 1))) { ast_log(LOG_WARNING, "Using default value of 1000ms, 1 iteration\n"); } Index: apps/app_sayunixtime.c =================================================================== --- apps/app_sayunixtime.c (revision 211525) +++ apps/app_sayunixtime.c (revision 211526) @@ -96,7 +96,7 @@ timec = strsep(&s,"|"); if ((timec) && (*timec != '\0')) { long timein; - if (sscanf(timec,"%ld",&timein) == 1) { + if (sscanf(timec,"%30ld",&timein) == 1) { unixtime = (time_t)timein; } } Index: apps/app_disa.c =================================================================== --- apps/app_disa.c (revision 211525) +++ apps/app_disa.c (revision 211526) @@ -249,7 +249,7 @@ if (j == '#') /* end of password */ { /* see if this is an integer */ - if (sscanf(args.passcode,"%d",&j) < 1) + if (sscanf(args.passcode,"%30d",&j) < 1) { /* nope, it must be a filename */ fp = fopen(args.passcode,"r"); if (!fp) @@ -274,7 +274,7 @@ ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox); /* password must be in valid format (numeric) */ - if (sscanf(args.passcode,"%d",&j) < 1) continue; + if (sscanf(args.passcode,"%30d",&j) < 1) continue; /* if we got it */ if (!strcmp(exten,args.passcode)) { if (ast_strlen_zero(args.context)) Index: apps/app_osplookup.c =================================================================== --- apps/app_osplookup.c (revision 211525) +++ apps/app_osplookup.c (revision 211526) @@ -216,11 +216,11 @@ cause = str2cause(args.cause); temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE"); result.handle = -1; - if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.handle) != 1)) { + if (ast_strlen_zero(temp) || (sscanf(temp, "%30d", &result.handle) != 1)) { result.handle = -1; } temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS"); - if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) { + if (ast_strlen_zero(temp) || (sscanf(temp, "%30d", &result.numresults) != 1)) { result.numresults = 0; } if ((res = ast_osp_next(&result, cause)) > 0) { @@ -301,7 +301,7 @@ cause = str2cause(args.status); temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE"); result.handle = -1; - if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) { + if (!ast_strlen_zero(temp) && (sscanf(temp, "%30d", &result.handle) == 1) && (result.handle > -1)) { if (!ast_osp_terminate(result.handle, cause, start, duration)) { pbx_builtin_setvar_helper(chan, "_OSPHANDLE", ""); pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", "SUCCESS"); Index: apps/app_zapbarge.c =================================================================== --- apps/app_zapbarge.c (revision 211525) +++ apps/app_zapbarge.c (revision 211526) @@ -272,8 +272,8 @@ LOCAL_USER_ADD(u); if (!ast_strlen_zero(data)) { - if ((sscanf(data, "Zap/%d", &confno) != 1) && - (sscanf(data, "%d", &confno) != 1)) { + if ((sscanf(data, "Zap/%3d", &confno) != 1) && + (sscanf(data, "%3d", &confno) != 1)) { ast_log(LOG_WARNING, "ZapBarge Argument (if specified) must be a channel number, not '%s'\n", (char *)data); LOCAL_USER_REMOVE(u); return 0; @@ -288,7 +288,7 @@ confstr[0] = '\0'; res = ast_app_getdata(chan, "conf-getchannel",confstr, sizeof(confstr) - 1, 0); if (res <0) goto out; - if (sscanf(confstr, "%d", &confno) != 1) + if (sscanf(confstr, "%3d", &confno) != 1) confno = 0; } if (confno) { Index: apps/app_privacy.c =================================================================== --- apps/app_privacy.c (revision 211525) +++ apps/app_privacy.c (revision 211526) @@ -125,13 +125,13 @@ AST_STANDARD_APP_ARGS(args, parse); if (args.maxretries) { - if (sscanf(args.maxretries, "%d", &x) == 1) + if (sscanf(args.maxretries, "%30d", &x) == 1) maxretries = x; else ast_log(LOG_WARNING, "Invalid max retries argument\n"); } if (args.minlength) { - if (sscanf(args.minlength, "%d", &x) == 1) + if (sscanf(args.minlength, "%30d", &x) == 1) minlength = x; else ast_log(LOG_WARNING, "Invalid min length argument\n"); @@ -148,14 +148,14 @@ 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: apps/app_record.c =================================================================== --- apps/app_record.c (revision 211525) +++ apps/app_record.c (revision 211526) @@ -146,7 +146,7 @@ return -1; } if (silstr) { - if ((sscanf(silstr, "%d", &i) == 1) && (i > -1)) { + if ((sscanf(silstr, "%30d", &i) == 1) && (i > -1)) { silence = i * 1000; } else if (!ast_strlen_zero(silstr)) { ast_log(LOG_WARNING, "'%s' is not a valid silence duration\n", silstr); @@ -154,7 +154,7 @@ } 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: apps/app_random.c =================================================================== --- apps/app_random.c (revision 211525) +++ apps/app_random.c (revision 211526) @@ -79,7 +79,7 @@ } prob = strsep(&s,":"); - if ((!prob) || (sscanf(prob, "%d", &probint) != 1)) + if ((!prob) || (sscanf(prob, "%3d", &probint) != 1)) probint = 0; if ((random() % 100) + probint >= 100) { Index: apps/app_queue.c =================================================================== --- apps/app_queue.c (revision 211525) +++ apps/app_queue.c (revision 211526) @@ -2973,7 +2973,7 @@ } if (!ast_strlen_zero(args.penalty)) { - if ((sscanf(args.penalty, "%d", &penalty) != 1) || penalty < 0) { + if ((sscanf(args.penalty, "%30d", &penalty) != 1) || penalty < 0) { ast_log(LOG_WARNING, "Penalty '%s' is invalid, must be an integer >= 0\n", args.penalty); penalty = 0; } @@ -3062,7 +3062,7 @@ /* Get the priority from the variable ${QUEUE_PRIO} */ user_priority = pbx_builtin_getvar_helper(chan, "QUEUE_PRIO"); if (user_priority) { - if (sscanf(user_priority, "%d", &prio) == 1) { + if (sscanf(user_priority, "%30d", &prio) == 1) { if (option_debug) ast_log(LOG_DEBUG, "%s: Got priority %d from ${QUEUE_PRIO}.\n", chan->name, prio); @@ -3716,7 +3716,7 @@ if (ast_strlen_zero(penalty_s)) penalty = 0; - else if (sscanf(penalty_s, "%d", &penalty) != 1) { + else if (sscanf(penalty_s, "%30d", &penalty) != 1) { penalty = 0; } @@ -3814,7 +3814,7 @@ 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: apps/app_cut.c =================================================================== --- apps/app_cut.c (revision 211525) +++ apps/app_cut.c (revision 211526) @@ -134,7 +134,7 @@ *ptrvalue = '\0'; ptrvalue++; sortable_keys[count2].key = ptrkey; - sscanf(ptrvalue, "%f", &sortable_keys[count2].value); + sscanf(ptrvalue, "%30f", &sortable_keys[count2].value); count2++; } @@ -206,15 +206,15 @@ 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: apps/app_waitforring.c =================================================================== --- apps/app_waitforring.c (revision 211525) +++ apps/app_waitforring.c (revision 211526) @@ -63,7 +63,7 @@ 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: Makefile =================================================================== --- Makefile (revision 211525) +++ Makefile (revision 211526) @@ -140,7 +140,7 @@ AGI_DIR=$(ASTVARLIBDIR)/agi-bin endif -ASTCFLAGS= +ASTCFLAGS=-Wformat-security # Pentium Pro Optimize #PROC=i686 Index: acl.c =================================================================== --- acl.c (revision 211525) +++ acl.c (revision 211526) @@ -165,7 +165,7 @@ 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>= 1; @@ -250,7 +250,7 @@ int ast_str2tos(const char *value, int *tos) { int fval; - if (sscanf(value, "%i", &fval) == 1) + if (sscanf(value, "%30i", &fval) == 1) *tos = fval & 0xff; else if (!strcasecmp(value, "lowdelay")) *tos = IPTOS_LOWDELAY; Index: muted.c =================================================================== --- muted.c (revision 211525) +++ muted.c (revision 211526) @@ -139,7 +139,7 @@ } else if (!strcasecmp(buf, "smoothfade")) { smoothfade = 1; } else if (!strcasecmp(buf, "mutelevel")) { - if (val && (sscanf(val, "%d", &x) == 1) && (x > -1) && (x < 101)) { + if (val && (sscanf(val, "%30d", &x) == 1) && (x > -1) && (x < 101)) { mutelevel = x; } else fprintf(stderr, "mutelevel must be a number from 0 (most muted) to 100 (no mute) at line %d\n", lineno); @@ -199,7 +199,7 @@ if (ports) { *ports = '\0'; ports++; - if ((sscanf(ports, "%d", &port) != 1) || (port < 1) || (port > 65535)) { + if ((sscanf(ports, "%30d", &port) != 1) || (port < 1) || (port > 65535)) { fprintf(stderr, "'%s' is not a valid port number in the hostname\n", ports); return -1; } Index: asterisk.c =================================================================== --- asterisk.c (revision 211525) +++ asterisk.c (revision 211526) @@ -706,7 +706,7 @@ if (!ast_strlen_zero(ast_config_AST_CTL_PERMISSIONS)) { int p1; mode_t p; - sscanf(ast_config_AST_CTL_PERMISSIONS, "%o", &p1); + sscanf(ast_config_AST_CTL_PERMISSIONS, "%30o", &p1); p = p1; if ((chmod(ast_config_AST_SOCKET, p)) < 0) ast_log(LOG_WARNING, "Unable to change file permissions of %s: %s\n", ast_config_AST_SOCKET, strerror(errno)); @@ -1357,10 +1357,10 @@ switch (*t) { case 'C': /* color */ t++; - if (sscanf(t, "%d;%d%n", &fgcolor, &bgcolor, &i) == 2) { + if (sscanf(t, "%30d;%30d%n", &fgcolor, &bgcolor, &i) == 2) { strncat(p, term_color_code(term_code, fgcolor, bgcolor, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1); t += i - 1; - } else if (sscanf(t, "%d%n", &fgcolor, &i) == 1) { + } else if (sscanf(t, "%30d%n", &fgcolor, &i) == 1) { strncat(p, term_color_code(term_code, fgcolor, 0, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1); t += i - 1; } @@ -1405,9 +1405,9 @@ if ((LOADAVG = fopen("/proc/loadavg", "r"))) { float avg1, avg2, avg3; int actproc, totproc, npid, which; - fscanf(LOADAVG, "%f %f %f %d/%d %d", + fscanf(LOADAVG, "%30f %30f %30f %30d/%30d %30d", &avg1, &avg2, &avg3, &actproc, &totproc, &npid); - if (sscanf(t, "%d", &which) == 1) { + if (sscanf(t, "%30d", &which) == 1) { switch (which) { case 1: snprintf(p, sizeof(prompt) - strlen(prompt), "%.2f", avg1); @@ -1949,7 +1949,7 @@ /* debug level (-d at startup) */ } else if (!strcasecmp(v->name, "debug")) { option_debug = 0; - if (sscanf(v->value, "%d", &option_debug) != 1) { + if (sscanf(v->value, "%30d", &option_debug) != 1) { option_debug = ast_true(v->value); } /* Disable forking (-f at startup) */ @@ -1989,7 +1989,7 @@ } else if (!strcasecmp(v->name, "transmit_silence_during_record")) { option_transmit_silence_during_record = ast_true(v->value); } else if (!strcasecmp(v->name, "maxcalls")) { - if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) { + if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) { option_maxcalls = 0; } } else if (!strcasecmp(v->name, "maxload")) { @@ -1998,7 +1998,7 @@ if (getloadavg(test, 1) == -1) { ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n"); option_maxload = 0.0; - } else if ((sscanf(v->value, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) { + } else if ((sscanf(v->value, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) { option_maxload = 0.0; } /* What user to run as */ @@ -2118,11 +2118,11 @@ option_nofork++; break; case 'M': - if ((sscanf(optarg, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) + if ((sscanf(optarg, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) option_maxcalls = 0; break; case 'L': - if ((sscanf(optarg, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) + if ((sscanf(optarg, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) option_maxload = 0.0; break; case 'q': Index: frame.c =================================================================== --- frame.c (revision 211525) +++ frame.c (revision 211526) @@ -653,7 +653,7 @@ if (argc != 3) return RESULT_SHOWUSAGE; - if (sscanf(argv[2],"%d",&codec) != 1) + if (sscanf(argv[2],"%30d",&codec) != 1) return RESULT_SHOWUSAGE; for (i=0;i<32;i++) Index: indications.c =================================================================== --- indications.c (revision 211525) +++ indications.c (revision 211526) @@ -238,46 +238,46 @@ 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: cli.c =================================================================== --- cli.c (revision 211525) +++ cli.c (revision 211526) @@ -643,7 +643,7 @@ char *filename = ""; if ((argc < 3) || (argc > 4)) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &newlevel) != 1) + if (sscanf(argv[2], "%5d", &newlevel) != 1) return RESULT_SHOWUSAGE; option_debug = newlevel; if (argc == 4) { Index: pbx.c =================================================================== --- pbx.c (revision 211525) +++ pbx.c (revision 211526) @@ -950,7 +950,7 @@ } pvn_endfor: if (offsetchar) { - sscanf(offsetchar, "%d:%d", offset, length); + sscanf(offsetchar, "%30d:%30d", offset, length); return 1; } else { return 0; @@ -3890,11 +3890,11 @@ ast_log(LOG_WARNING, "Invalid time range. Assuming no restrictions based on time.\n"); return; } - if (sscanf(times, "%d:%d", &s1, &s2) != 2) { + if (sscanf(times, "%2d:%2d", &s1, &s2) != 2) { ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", times); return; } - if (sscanf(e, "%d:%d", &e1, &e2) != 2) { + if (sscanf(e, "%2d:%2d", &e1, &e2) != 2) { ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", e); return; } @@ -4016,7 +4016,7 @@ c++; } /* Find the start */ - if (sscanf(day, "%d", &s) != 1) { + if (sscanf(day, "%1d", &s) != 1) { ast_log(LOG_WARNING, "Invalid day '%s', assuming none\n", day); return 0; } @@ -4026,7 +4026,7 @@ } s--; if (c) { - if (sscanf(c, "%d", &e) != 1) { + if (sscanf(c, "%1d", &e) != 1) { ast_log(LOG_WARNING, "Invalid day '%s', assuming none\n", c); return 0; } @@ -5422,7 +5422,7 @@ struct ast_frame *f; int waittime; - if (ast_strlen_zero(data) || (sscanf(data, "%d", &waittime) != 1) || (waittime < 0)) + if (ast_strlen_zero(data) || (sscanf(data, "%30d", &waittime) != 1) || (waittime < 0)) waittime = -1; if (waittime > -1) { ast_safe_sleep(chan, waittime * 1000); @@ -6537,7 +6537,7 @@ mode = -1; pri++; } - if (sscanf(pri, "%d", &ipri) != 1) { + if (sscanf(pri, "%30d", &ipri) != 1) { if ((ipri = ast_findlabel_extension(chan, context ? context : chan->context, (exten && strcasecmp(exten, "BYEXTENSION")) ? exten : chan->exten, pri, chan->cid.cid_num)) < 1) { ast_log(LOG_WARNING, "Priority '%s' must be a number > 0, or valid label\n", pri); Index: dnsmgr.c =================================================================== --- dnsmgr.c (revision 211525) +++ dnsmgr.c (revision 211526) @@ -324,7 +324,7 @@ 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: funcs/func_strings.c =================================================================== --- funcs/func_strings.c (revision 211525) +++ funcs/func_strings.c (revision 211526) @@ -169,7 +169,7 @@ epoch = strsep(&format, "|"); timezone = strsep(&format, "|"); - if (ast_strlen_zero(epoch) || !sscanf(epoch, "%ld", &epochi)) { + if (ast_strlen_zero(epoch) || !sscanf(epoch, "%30ld", &epochi)) { struct timeval tv = ast_tvnow(); epochi = tv.tv_sec; } Index: funcs/func_math.c =================================================================== --- funcs/func_math.c (revision 211525) +++ funcs/func_math.c (revision 211526) @@ -159,12 +159,12 @@ return NULL; } - if (sscanf(mvalue1, "%lf", &fnum1) != 1) { + if (sscanf(mvalue1, "%30lf", &fnum1) != 1) { ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue1); return NULL; } - if (sscanf(mvalue2, "%lf", &fnum2) != 1) { + if (sscanf(mvalue2, "%30lf", &fnum2) != 1) { ast_log(LOG_WARNING, "'%s' is not a valid number\n", mvalue2); return NULL; } Index: res/res_features.c =================================================================== --- res/res_features.c (revision 211525) +++ res/res_features.c (revision 211526) @@ -2004,13 +2004,13 @@ } else if (!strcasecmp(var->name, "context")) { ast_copy_string(parking_con, var->value, sizeof(parking_con)); } else if (!strcasecmp(var->name, "parkingtime")) { - if ((sscanf(var->value, "%d", &parkingtime) != 1) || (parkingtime < 1)) { + if ((sscanf(var->value, "%30d", &parkingtime) != 1) || (parkingtime < 1)) { ast_log(LOG_WARNING, "%s is not a valid parkingtime\n", var->value); parkingtime = DEFAULT_PARK_TIME; } else parkingtime = parkingtime * 1000; } else if (!strcasecmp(var->name, "parkpos")) { - if (sscanf(var->value, "%d-%d", &start, &end) != 2) { + if (sscanf(var->value, "%30d-%30d", &start, &end) != 2) { ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of parking.conf\n", var->lineno); } else { parking_start = start; @@ -2021,13 +2021,13 @@ } else if (!strcasecmp(var->name, "adsipark")) { adsipark = ast_true(var->value); } else if (!strcasecmp(var->name, "transferdigittimeout")) { - if ((sscanf(var->value, "%d", &transferdigittimeout) != 1) || (transferdigittimeout < 1)) { + if ((sscanf(var->value, "%30d", &transferdigittimeout) != 1) || (transferdigittimeout < 1)) { ast_log(LOG_WARNING, "%s is not a valid transferdigittimeout\n", var->value); transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT; } else transferdigittimeout = transferdigittimeout * 1000; } else if (!strcasecmp(var->name, "featuredigittimeout")) { - if ((sscanf(var->value, "%d", &featuredigittimeout) != 1) || (featuredigittimeout < 1)) { + if ((sscanf(var->value, "%30d", &featuredigittimeout) != 1) || (featuredigittimeout < 1)) { ast_log(LOG_WARNING, "%s is not a valid featuredigittimeout\n", var->value); featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT; } Index: res/res_agi.c =================================================================== --- res/res_agi.c (revision 211525) +++ res/res_agi.c (revision 211526) @@ -399,7 +399,7 @@ int to; if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[3], "%d", &to) != 1) + if (sscanf(argv[3], "%30d", &to) != 1) return RESULT_SHOWUSAGE; res = ast_waitfordigit_full(chan, to, agi->audio, agi->ctrl); fdprintf(agi->fd, "200 result=%d\n", res); @@ -518,7 +518,7 @@ else stop = NULL; - if ((argc > 5) && (sscanf(argv[5], "%d", &skipms) != 1)) + if ((argc > 5) && (sscanf(argv[5], "%30d", &skipms) != 1)) return RESULT_SHOWUSAGE; if (argc > 6 && !ast_strlen_zero(argv[6])) @@ -557,7 +557,7 @@ return RESULT_SHOWUSAGE; if (argc > 5) return RESULT_SHOWUSAGE; - if ((argc > 4) && (sscanf(argv[4], "%ld", &sample_offset) != 1)) + if ((argc > 4) && (sscanf(argv[4], "%30ld", &sample_offset) != 1)) return RESULT_SHOWUSAGE; fs = ast_openstream(chan, argv[2], chan->language); @@ -660,7 +660,7 @@ int num; if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_number_full(chan, num, argv[3], chan->language, (char *) NULL, agi->audio, agi->ctrl); if (res == 1) @@ -679,7 +679,7 @@ if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_digit_str_full(chan, argv[2], argv[3], chan->language, agi->audio, agi->ctrl); @@ -715,7 +715,7 @@ int num; if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_date(chan, num, argv[3], chan->language); if (res == 1) @@ -733,7 +733,7 @@ int num; if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_time(chan, num, argv[3], chan->language); if (res == 1) @@ -767,7 +767,7 @@ if (argc > 5 && !ast_strlen_zero(argv[5])) zone = argv[5]; - if (sscanf(argv[2], "%ld", &unixtime) != 1) + if (sscanf(argv[2], "%30ld", &unixtime) != 1) return RESULT_SHOWUSAGE; res = ast_say_date_with_format(chan, (time_t) unixtime, argv[3], chan->language, format, zone); @@ -853,7 +853,7 @@ if (argc != 3) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &pri) != 1) { + if (sscanf(argv[2], "%30d", &pri) != 1) { if ((pri = ast_findlabel_extension(chan, chan->context, chan->exten, argv[2], chan->cid.cid_num)) < 1) return RESULT_SHOWUSAGE; } @@ -885,7 +885,7 @@ if (argc < 6) return RESULT_SHOWUSAGE; - if (sscanf(argv[5], "%d", &ms) != 1) + if (sscanf(argv[5], "%30d", &ms) != 1) return RESULT_SHOWUSAGE; if (argc > 6) @@ -926,7 +926,7 @@ /* backward compatibility, if no offset given, arg[6] would have been * caught below and taken to be a beep, else if it is a digit then it is a * offset */ - if ((argc >6) && (sscanf(argv[6], "%ld", &sample_offset) != 1) && (!strchr(argv[6], '='))) + if ((argc >6) && (sscanf(argv[6], "%30ld", &sample_offset) != 1) && (!strchr(argv[6], '='))) res = ast_streamfile(chan, "beep", chan->language); if ((argc > 7) && (!strchr(argv[7], '='))) @@ -1044,7 +1044,7 @@ if (argc != 3) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &timeout) != 1) + if (sscanf(argv[2], "%30d", &timeout) != 1) return RESULT_SHOWUSAGE; if (timeout < 0) timeout = 0; @@ -1215,7 +1215,7 @@ return RESULT_SHOWUSAGE; if (argv[2]) - sscanf(argv[2], "%d", &level); + sscanf(argv[2], "%30d", &level); switch (level) { case 4: Index: res/res_osp.c =================================================================== --- res/res_osp.c (revision 211525) +++ res/res_osp.c (revision 211526) @@ -167,22 +167,22 @@ } else ast_log(LOG_WARNING, "Too many Service points at line %d\n", v->lineno); } else if (!strcasecmp(v->name, "maxconnections")) { - if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x <= 1000)) { + if ((sscanf(v->value, "%30d", &x) == 1) && (x > 0) && (x <= 1000)) { osp->maxconnections = x; } else ast_log(LOG_WARNING, "maxconnections should be an integer from 1 to 1000, not '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "retrydelay")) { - if ((sscanf(v->value, "%d", &x) == 1) && (x >= 0) && (x <= 10)) { + if ((sscanf(v->value, "%30d", &x) == 1) && (x >= 0) && (x <= 10)) { osp->retrydelay = x; } else ast_log(LOG_WARNING, "retrydelay should be an integer from 0 to 10, not '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "retrylimit")) { - if ((sscanf(v->value, "%d", &x) == 1) && (x >= 0) && (x <= 100)) { + if ((sscanf(v->value, "%30d", &x) == 1) && (x >= 0) && (x <= 100)) { osp->retrylimit = x; } else ast_log(LOG_WARNING, "retrylimit should be an integer from 0 to 100, not '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "timeout")) { - if ((sscanf(v->value, "%d", &x) == 1) && (x >= 200) && (x <= 10000)) { + if ((sscanf(v->value, "%30d", &x) == 1) && (x >= 200) && (x <= 10000)) { osp->timeout = x; } else ast_log(LOG_WARNING, "timeout should be an integer from 200 to 10000, not '%s' at line %d\n", v->value, v->lineno); @@ -809,7 +809,7 @@ } cat = ast_variable_retrieve(cfg, "general", "tokenformat"); if (cat) { - if ((sscanf(cat, "%d", &tokenformat) != 1) || (tokenformat < TOKEN_ALGO_SIGNED) || (tokenformat > TOKEN_ALGO_BOTH)) { + if ((sscanf(cat, "%30d", &tokenformat) != 1) || (tokenformat < TOKEN_ALGO_SIGNED) || (tokenformat > TOKEN_ALGO_BOTH)) { tokenformat = TOKEN_ALGO_SIGNED; ast_log(LOG_WARNING, "tokenformat should be an integer from 0 to 2, not '%s'\n", cat); } Index: codecs/codec_speex.c =================================================================== --- codecs/codec_speex.c (revision 211525) +++ codecs/codec_speex.c (revision 211526) @@ -451,7 +451,7 @@ } else ast_log(LOG_ERROR,"Error! Complexity must be 0-10\n"); } else if (!strcasecmp(var->name, "vbr_quality")) { - if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0 && res_f <= 10) { + if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0 && res_f <= 10) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting VBR Quality to %f\n",res_f); ast_mutex_lock(&localuser_lock); @@ -518,7 +518,7 @@ ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off"); ast_mutex_unlock(&localuser_lock); } else if (!strcasecmp(var->name, "pp_agc_level")) { - if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) { + if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f); ast_mutex_lock(&localuser_lock); @@ -539,7 +539,7 @@ ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off"); ast_mutex_unlock(&localuser_lock); } else if (!strcasecmp(var->name, "pp_dereverb_decay")) { - if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) { + if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f); ast_mutex_lock(&localuser_lock); @@ -548,7 +548,7 @@ } else ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Decay must be >= 0\n"); } else if (!strcasecmp(var->name, "pp_dereverb_level")) { - if (sscanf(var->value, "%f", &res_f) == 1 && res_f >= 0) { + if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f); ast_mutex_lock(&localuser_lock); Index: utils/frame.c =================================================================== --- utils/frame.c (revision 211525) +++ utils/frame.c (revision 211526) @@ -299,7 +299,7 @@ double temp; char m, s, end; - k = sscanf(string, "%lf%c%c%c", &temp, &m, &s, &end); + k = sscanf(string, "%30lf%1c%1c%1c", &temp, &m, &s, &end); switch (k) { case 0: case EOF: case 4: @@ -340,7 +340,7 @@ double temp; char m, s, end; - k = sscanf(string, "%lf%c%c%c", &temp, &m, &s, &end); + k = sscanf(string, "%30lf%1c%1c%1c", &temp, &m, &s, &end); switch (k) { case 0: case EOF: case 2: case 4: @@ -420,7 +420,7 @@ if ((i = findoption( argcount, args, string)) > 0) { switch (sscanf(args[i] + 1 + strlen( string), - "%d%c", &temp, &c)) + "%30d%1c", &temp, &c)) { case 0: case EOF: case 2: argerrornum(args[i]+1, ME_NOINT); @@ -454,7 +454,7 @@ if ((i = findoption( argcount, args, string)) > 0) { - switch (sscanf(args[i] + 1 + strlen( string), "%lf%c", &temp, &end)) + switch (sscanf(args[i] + 1 + strlen( string), "%30lf%1c", &temp, &end)) { case 0: case EOF: case 2: argerrornum(args[i]+1, ME_NODOUBLE); @@ -489,7 +489,7 @@ if ((i = findoption( argcount, args, string)) > 0) { switch (sscanf(args[i] + 1 + strlen( string), - "%lf%c%c%c", &vol, &sbd, &sbb, &end)) + "%30lf%1c%1c%1c", &vol, &sbd, &sbb, &end)) { case 0: case EOF: case 4: weird = TRUE; @@ -537,7 +537,7 @@ 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: Property changes on: . ___________________________________________________________________ Added: automerge + * Added: svnmerge-integrated + /branches/1.2:1-209600 Added: automerge-email + tilghman@mail.jeffandtilghman.com