aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c8
-rw-r--r--channels/chan_dahdi.c42
-rw-r--r--channels/chan_iax2.c8
-rw-r--r--channels/chan_mgcp.c14
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_oss.c2
-rw-r--r--channels/chan_phone.c2
-rw-r--r--channels/chan_sip.c137
-rw-r--r--channels/chan_skinny.c2
-rw-r--r--channels/chan_usbradio.c10
-rw-r--r--channels/iax2-provision.c4
-rw-r--r--channels/misdn_config.c10
12 files changed, 131 insertions, 110 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index c703849d3..7800e4a05 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1322,9 +1322,9 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
struct timeval tv;
s = data;
- if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ if ((s[0] == '@') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
- } else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ } else if ((s[0] == ':') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
waitforagent = 1;
} else
@@ -2287,9 +2287,9 @@ static int agent_devicestate(void *data)
int res = AST_DEVICE_INVALID;
s = data;
- if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1))
+ if ((s[0] == '@') && (sscanf(s + 1, "%30d", &groupoff) == 1))
groupmatch = (1 << groupoff);
- else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ else if ((s[0] == ':') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
} else
groupmatch = 0;
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 58de082b7..fafaa9796 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -8443,7 +8443,7 @@ static unsigned int parse_pointcode(const char *pcstring)
unsigned int code1, code2, code3;
int numvals;
- numvals = sscanf(pcstring, "%d-%d-%d", &code1, &code2, &code3);
+ numvals = sscanf(pcstring, "%30d-%30d-%30d", &code1, &code2, &code3);
if (numvals == 1)
return code1;
if (numvals == 3)
@@ -9268,7 +9268,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
stringp = dest + 1;
s = strsep(&stringp, "/");
- if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+ if ((res = sscanf(s, "%30d%1c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine group for data %s\n", (char *)data);
return NULL;
}
@@ -9304,7 +9304,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
channelmatch = x;
}
#ifdef HAVE_PRI
- else if ((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) > 1) {
+ else if ((res = sscanf(s, "%30d:%30d%1c%30d", &trunkgroup, &crv, &opt, &y)) > 1) {
if ((trunkgroup < 1) || (crv < 1)) {
ast_log(LOG_WARNING, "Unable to determine trunk group and CRV for data %s\n", (char *)data);
return NULL;
@@ -9326,8 +9326,8 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
channelmatch = crv;
p = pris[x].crvs;
}
-#endif
- else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+#endif
+ else if ((res = sscanf(s, "%30d%1c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data);
return NULL;
} else {
@@ -12512,7 +12512,7 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli
return CLI_SHOWUSAGE;
#ifdef HAVE_PRI
if ((c = strchr(a->argv[3], ':'))) {
- if (sscanf(a->argv[3], "%d:%d", &trunkgroup, &channel) != 2)
+ if (sscanf(a->argv[3], "%30d:%30d", &trunkgroup, &channel) != 2)
return CLI_SHOWUSAGE;
if ((trunkgroup < 1) || (channel < 1))
return CLI_SHOWUSAGE;
@@ -13787,7 +13787,7 @@ static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *v
#ifdef HAVE_PRI
pri = NULL;
if (iscrv) {
- if (sscanf(c, "%d:%n", &trunkgroup, &y) != 1) {
+ if (sscanf(c, "%30d:%n", &trunkgroup, &y) != 1) {
ast_log(LOG_WARNING, "CRV must begin with trunkgroup followed by a colon at line %d.\n", lineno);
return -1;
}
@@ -13810,9 +13810,9 @@ static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *v
#endif
while ((chan = strsep(&c, ","))) {
- if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
+ if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) {
/* Range */
- } else if (sscanf(chan, "%d", &start)) {
+ } else if (sscanf(chan, "%30d", &start)) {
/* Just one */
finish = start;
} else if (!strcasecmp(chan, "pseudo")) {
@@ -13901,7 +13901,7 @@ static void process_echocancel(struct dahdi_chan_conf *confp, const char *data,
strcpy(confp->chan.echocancel.params[confp->chan.echocancel.head.param_count].name, param.name);
if (param.value) {
- if (sscanf(param.value, "%d", &confp->chan.echocancel.params[confp->chan.echocancel.head.param_count].value) != 1) {
+ if (sscanf(param.value, "%30d", &confp->chan.echocancel.params[confp->chan.echocancel.head.param_count].value) != 1) {
ast_log(LOG_WARNING, "Invalid echocancel parameter value supplied at line %d: '%s'\n", line, param.value);
continue;
}
@@ -13938,7 +13938,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
int res;
char policy[21] = "";
- res = sscanf(v->value, "%d,%20s", &confp->chan.buf_no, policy);
+ res = sscanf(v->value, "%30d,%20s", &confp->chan.buf_no, policy);
if (res != 2) {
ast_log(LOG_WARNING, "Parsing buffers option data failed, using defaults.\n");
confp->chan.buf_no = numbufs;
@@ -13972,11 +13972,11 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
} else if (!strcasecmp(v->name, "dring3range")) {
confp->chan.drings.ringnum[2].range = atoi(v->value);
} else if (!strcasecmp(v->name, "dring1")) {
- sscanf(v->value, "%d,%d,%d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);
+ sscanf(v->value, "%30d,%30d,%30d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);
} else if (!strcasecmp(v->name, "dring2")) {
- sscanf(v->value,"%d,%d,%d", &confp->chan.drings.ringnum[1].ring[0], &confp->chan.drings.ringnum[1].ring[1], &confp->chan.drings.ringnum[1].ring[2]);
+ sscanf(v->value, "%30d,%30d,%30d", &confp->chan.drings.ringnum[1].ring[0], &confp->chan.drings.ringnum[1].ring[1], &confp->chan.drings.ringnum[1].ring[2]);
} else if (!strcasecmp(v->name, "dring3")) {
- sscanf(v->value, "%d,%d,%d", &confp->chan.drings.ringnum[2].ring[0], &confp->chan.drings.ringnum[2].ring[1], &confp->chan.drings.ringnum[2].ring[2]);
+ sscanf(v->value, "%30d,%30d,%30d", &confp->chan.drings.ringnum[2].ring[0], &confp->chan.drings.ringnum[2].ring[1], &confp->chan.drings.ringnum[2].ring[2]);
} else if (!strcasecmp(v->name, "usecallerid")) {
confp->chan.use_callerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "cidsignalling")) {
@@ -14029,7 +14029,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
} else if (!strcasecmp(v->name, "busycount")) {
confp->chan.busycount = atoi(v->value);
} else if (!strcasecmp(v->name, "busypattern")) {
- if (sscanf(v->value, "%d,%d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
+ if (sscanf(v->value, "%30d,%30d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength at line %d.\n", v->lineno);
}
} else if (!strcasecmp(v->name, "callprogress")) {
@@ -14047,7 +14047,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
} else if (!strcasecmp(v->name, "echocancel")) {
process_echocancel(confp, v->value, v->lineno);
} else if (!strcasecmp(v->name, "echotraining")) {
- if (sscanf(v->value, "%d", &y) == 1) {
+ if (sscanf(v->value, "%30d", &y) == 1) {
if ((y < 10) || (y > 4000)) {
ast_log(LOG_WARNING, "Echo training time must be within the range of 10 to 4000 ms at line %d.\n", v->lineno);
} else {
@@ -14123,19 +14123,19 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
confp->chan.mwimonitor_fsk = ast_true(v->value) ? 1 : 0;
}
} else if (!strcasecmp(v->name, "cid_rxgain")) {
- if (sscanf(v->value, "%f", &confp->chan.cid_rxgain) != 1) {
+ if (sscanf(v->value, "%30f", &confp->chan.cid_rxgain) != 1) {
ast_log(LOG_WARNING, "Invalid cid_rxgain: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "rxgain")) {
- if (sscanf(v->value, "%f", &confp->chan.rxgain) != 1) {
+ if (sscanf(v->value, "%30f", &confp->chan.rxgain) != 1) {
ast_log(LOG_WARNING, "Invalid rxgain: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "txgain")) {
- if (sscanf(v->value, "%f", &confp->chan.txgain) != 1) {
+ if (sscanf(v->value, "%30f", &confp->chan.txgain) != 1) {
ast_log(LOG_WARNING, "Invalid txgain: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "tonezone")) {
- if (sscanf(v->value, "%d", &confp->chan.tonezone) != 1) {
+ if (sscanf(v->value, "%30d", &confp->chan.tonezone) != 1) {
ast_log(LOG_WARNING, "Invalid tonezone: %s at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "callerid")) {
@@ -14572,7 +14572,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
ast_copy_string(original_args, v->value, sizeof(original_args));
/* 16 cadences allowed (8 pairs) */
- element_count = sscanf(v->value, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
+ element_count = sscanf(v->value, "%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
/* Cadence must be even (on/off) */
if (element_count % 2 == 1) {
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 95f2ba20d..13814aa8a 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -10733,18 +10733,18 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
peer->maxms = 0;
}
} else if (!strcasecmp(v->name, "qualifysmoothing")) {
peer->smoothing = ast_true(v->value);
} else if (!strcasecmp(v->name, "qualifyfreqok")) {
- if (sscanf(v->value, "%d", &peer->pokefreqok) != 1) {
+ if (sscanf(v->value, "%30d", &peer->pokefreqok) != 1) {
ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when OK should a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
}
} else if (!strcasecmp(v->name, "qualifyfreqnotok")) {
- if (sscanf(v->value, "%d", &peer->pokefreqnotok) != 1) {
+ if (sscanf(v->value, "%30d", &peer->pokefreqnotok) != 1) {
ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when NOT OK should be a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
} else ast_log(LOG_WARNING, "Set peer->pokefreqnotok to %d\n", peer->pokefreqnotok);
} else if (!strcasecmp(v->name, "timezone")) {
@@ -11326,7 +11326,7 @@ static int set_config(char *config_file, int reload)
if (trunkmaxsize == 0)
trunkmaxsize = MAX_TRUNKDATA;
} else if (!strcasecmp(v->name, "autokill")) {
- if (sscanf(v->value, "%d", &x) == 1) {
+ if (sscanf(v->value, "%30d", &x) == 1) {
if (x >= 0)
autokill = x;
else
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 887fdcfd0..067bc13d7 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1890,7 +1890,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c);
return -1;
}
- if (sscanf(m, "audio %d RTP/AVP %n", &portno, &len) != 1) {
+ if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1) {
ast_log(LOG_WARNING, "Unable to determine port number for RTP in '%s'\n", m);
return -1;
}
@@ -1905,7 +1905,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_rtp_pt_clear(sub->rtp);
codecs = ast_strdupa(m + len);
while (!ast_strlen_zero(codecs)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
if (codec_count)
break;
ast_log(LOG_WARNING, "Error in codec string '%s' at '%s'\n", m, codecs);
@@ -1921,7 +1921,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
sdpLineNum_iterator_init(&iterator);
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
char* mimeSubtype = ast_strdupa(a); /* ensures we have enough space */
- if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2)
+ if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) != 2)
continue;
/* Note: should really look at the 'freq' and '#chans' params too */
ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype, 0);
@@ -2054,7 +2054,7 @@ static int transmit_response(struct mgcp_subchannel *sub, char *msg, struct mgcp
mgr = ast_calloc(1, sizeof(*mgr) + resp.len + 1);
if (mgr) {
/* Store MGCP response in case we have to retransmit */
- sscanf(req->identifier, "%d", &mgr->seqno);
+ sscanf(req->identifier, "%30d", &mgr->seqno);
time(&mgr->whensent);
mgr->len = resp.len;
memcpy(mgr->buf, resp.data, resp.len);
@@ -3287,7 +3287,7 @@ static int find_and_retrans(struct mgcp_subchannel *sub, struct mgcp_request *re
time_t now;
struct mgcp_response *prev = NULL, *cur, *next, *answer=NULL;
time(&now);
- if (sscanf(req->identifier, "%d", &seqno) != 1)
+ if (sscanf(req->identifier, "%30d", &seqno) != 1)
seqno = 0;
cur = sub->parent->parent->responses;
while(cur) {
@@ -3345,7 +3345,7 @@ static int mgcpsock_read(int *id, int fd, short events, void *ignore)
return 1;
}
- if (sscanf(req.verb, "%d", &result) && sscanf(req.identifier, "%d", &ident)) {
+ if (sscanf(req.verb, "%30d", &result) && sscanf(req.identifier, "%30d", &ident)) {
/* Try to find who this message is for, if it's important */
sub = find_subchannel_and_lock(NULL, ident, &sin);
if (sub) {
@@ -4162,7 +4162,7 @@ static int reload_config(int reload)
if (ast_str2cos(v->value, &cos_audio))
ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "port")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%5d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
} else {
ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index d325ebc4b..2170cecf0 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -1232,7 +1232,7 @@ static char *handle_cli_misdn_show_config(struct ast_cli_entry *e, int cmd, stru
ok = 1;
}
return ok ? CLI_SUCCESS : CLI_SHOWUSAGE;
- } else if (!sscanf(a->argv[3], "%d", &onlyport) || onlyport < 0) {
+ } else if (!sscanf(a->argv[3], "%5d", &onlyport) || onlyport < 0) {
ast_cli(a->fd, "Unknown option: %s\n", a->argv[3]);
return CLI_SHOWUSAGE;
}
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index c49b81d51..c9c0c7d4a 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1231,7 +1231,7 @@ static char *console_active(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
static void store_boost(struct chan_oss_pvt *o, const char *s)
{
double boost = 0;
- if (sscanf(s, "%lf", &boost) != 1) {
+ if (sscanf(s, "%30lf", &boost) != 1) {
ast_log(LOG_WARNING, "invalid boost <%s>\n", s);
return;
}
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 782218b1d..7a767fa03 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -1259,7 +1259,7 @@ static int parse_gain_value(const char *gain_type, const char *value)
float gain;
/* try to scan number */
- if (sscanf(value, "%f", &gain) != 1)
+ if (sscanf(value, "%30f", &gain) != 1)
{
ast_log(LOG_ERROR, "Invalid %s value '%s' in '%s' config\n",
value, gain_type, config);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ce7116b28..c037e653f 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2267,7 +2267,7 @@ static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_sessi
req.len = strlen(req.data);
}
parse_copy(&reqcpy, &req);
- if (sscanf(get_header(&reqcpy, "Content-Length"), "%d", &cl)) {
+ if (sscanf(get_header(&reqcpy, "Content-Length"), "%30d", &cl)) {
while (cl > 0) {
ast_mutex_lock(&tcptls_session->lock);
if (!fread(buf, (cl < sizeof(buf)) ? cl : sizeof(buf), 1, tcptls_session->f)) {
@@ -6452,7 +6452,7 @@ static int find_sdp(struct sip_request *req)
content_length = get_header(req, "Content-Length");
if (!ast_strlen_zero(content_length)) {
- if (sscanf(content_length, "%ud", &x) != 1) {
+ if (sscanf(content_length, "%30u", &x) != 1) {
ast_log(LOG_WARNING, "Invalid Content-Length: %s\n", content_length);
return 0;
}
@@ -6652,7 +6652,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_log(LOG_WARNING, "SDP sytax error in o= line\n");
return -1;
}
- if (!sscanf(token, "%" SCNu64, &rua_version)) {
+ if (!sscanf(token, "%30" SCNu64, &rua_version)) {
ast_log(LOG_WARNING, "SDP sytax error in o= line version\n");
return -1;
}
@@ -6710,15 +6710,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
numberofports = 1;
len = -1;
- if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
+ if ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
audio = TRUE;
numberofmediastreams++;
/* Found audio stream in this media definition */
portno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -6726,15 +6726,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_verbose("Found RTP audio format %d\n", codec);
ast_rtp_set_m_type(newaudiortp, codec);
}
- } else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1 && len >= 0)) {
+ } else if ((sscanf(m, "video %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1 && len >= 0)) {
video = TRUE;
p->novideo = FALSE;
numberofmediastreams++;
vportno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -6742,15 +6742,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_verbose("Found RTP video format %d\n", codec);
ast_rtp_set_m_type(newvideortp, codec);
}
- } else if ((sscanf(m, "text %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "text %d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
+ } else if ((sscanf(m, "text %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "text %30d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
text = TRUE;
p->notext = FALSE;
numberofmediastreams++;
tportno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -6758,8 +6758,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_verbose("Found RTP text format %d\n", codec);
ast_rtp_set_m_type(newtextrtp, codec);
}
- } else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1 && len > 0) ||
- (sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
+ } else if (p->udptl && ( (sscanf(m, "image %30d udptl t38%n", &x, &len) == 1 && len > 0) ||
+ (sscanf(m, "image %30d UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
if (debug)
ast_verbose("Got T.38 offer in SDP in dialog %s\n", p->callid);
udptlportno = x;
@@ -6946,7 +6946,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_rtp_codec_setpref(p->rtp, pref);
}
continue;
- } else if (sscanf(a, "rtpmap: %u %127[^/]/", &codec, mimeSubtype) == 2) {
+ } else if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) == 2) {
/* We have a rtpmap to handle */
if (last_rtpmap_codec < SDP_MAX_RTPMAP_CODECS) {
@@ -6997,10 +6997,10 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
/* Scan trough the a= lines for T38 attributes and set apropriate fileds */
iterator = req->sdp_start;
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
- if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
+ if ((sscanf(a, "T38FaxMaxBuffer:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "MaxBufferSize:%d\n", x);
- } else if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1) || (sscanf(a, "T38FaxMaxRate:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38MaxBitRate:%30d", &x) == 1) || (sscanf(a, "T38FaxMaxRate:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "T38MaxBitRate: %d\n", x);
switch (x) {
@@ -7023,21 +7023,21 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
peert38capability |= T38FAX_RATE_2400;
break;
}
- } else if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38FaxVersion:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "FaxVersion: %d\n", x);
if (x == 0)
peert38capability |= T38FAX_VERSION_0;
else if (x == 1)
peert38capability |= T38FAX_VERSION_1;
- } else if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1) || (sscanf(a, "T38MaxDatagram:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38FaxMaxDatagram:%30d", &x) == 1) || (sscanf(a, "T38MaxDatagram:%30d", &x) == 1)) {
found = 1;
ast_debug(3, "FaxMaxDatagram: %d\n", x);
ast_udptl_set_far_max_datagram(p->udptl, x);
ast_udptl_set_local_max_datagram(p->udptl, x);
} else if ((strncmp(a, "T38FaxFillBitRemoval", 20) == 0)) {
found = 1;
- if(sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1) {
+ if(sscanf(a, "T38FaxFillBitRemoval:%30d", &x) == 1) {
ast_debug(3, "FillBitRemoval: %d\n", x);
if(x == 1)
peert38capability |= T38FAX_FILL_BIT_REMOVAL;
@@ -7047,7 +7047,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
}
} else if ((strncmp(a, "T38FaxTranscodingMMR", 20) == 0)) {
found = 1;
- if(sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1) {
+ if(sscanf(a, "T38FaxTranscodingMMR:%30d", &x) == 1) {
ast_debug(3, "Transcoding MMR: %d\n", x);
if(x == 1)
peert38capability |= T38FAX_TRANSCODING_MMR;
@@ -7057,7 +7057,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
}
} else if ((strncmp(a, "T38FaxTranscodingJBIG", 21) == 0)) {
found = 1;
- if(sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1) {
+ if(sscanf(a, "T38FaxTranscodingJBIG:%30d", &x) == 1) {
ast_debug(3, "Transcoding JBIG: %d\n", x);
if(x == 1)
peert38capability |= T38FAX_TRANSCODING_JBIG;
@@ -7816,7 +7816,7 @@ static int __transmit_response(struct sip_pvt *p, const char *msg, const struct
struct sip_request resp;
int seqno = 0;
- if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+ if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -7984,7 +7984,7 @@ static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, const
char tmp[512];
int seqno = 0;
- if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+ if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -8626,7 +8626,7 @@ static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct s
struct sip_request resp;
int seqno;
- if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) {
+ if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -8665,7 +8665,7 @@ static int transmit_response_with_sdp(struct sip_pvt *p, const char *msg, const
{
struct sip_request resp;
int seqno;
- if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) {
+ if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -10128,7 +10128,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
char *s = strcasestr(contact, ";expires=");
if (s) {
expires = strsep(&s, ";"); /* trim ; and beyond */
- if (sscanf(expires + 9, "%d", &expiry) != 1)
+ if (sscanf(expires + 9, "%30d", &expiry) != 1)
expiry = default_expiry;
} else {
/* Nothing has been specified */
@@ -14685,7 +14685,7 @@ static int func_header_read(struct ast_channel *chan, const char *function, char
if (!args.number) {
number = 1;
} else {
- sscanf(args.number, "%d", &number);
+ sscanf(args.number, "%30d", &number);
if (number < 1)
number = 1;
}
@@ -15543,7 +15543,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
}
tmptmp = strcasestr(contact, "expires=");
if (tmptmp) {
- if (sscanf(tmptmp + 8, "%d;", &expires) != 1)
+ if (sscanf(tmptmp + 8, "%30d;", &expires) != 1)
expires = 0;
}
@@ -18639,7 +18639,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so
ast_log(LOG_ERROR, "Missing Cseq. Dropping this SIP message, it's incomplete.\n");
error = 1;
}
- if (!error && sscanf(cseq, "%d%n", &seqno, &len) != 1) {
+ if (!error && sscanf(cseq, "%30d%n", &seqno, &len) != 1) {
ast_log(LOG_ERROR, "No seqno in '%s'. Dropping incomplete message.\n", cmd);
error = 1;
}
@@ -18666,6 +18666,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so
* possibly process the request. In all cases, there function
* terminates at the end of this block
*/
+<<<<<<< .working
int ret = 0;
if (p->ocseq < seqno && seqno != p->lastnoninvite) {
@@ -18693,6 +18694,26 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so
if ((respid == 200) || ((respid >= 300) && (respid <= 399)))
extract_uri(p, req);
handle_response(p, respid, e + len, req, seqno);
+=======
+ if (ast_strlen_zero(e)) {
+ return 0;
+ }
+ if (sscanf(e, "%30d %n", &respid, &len) != 1) {
+ ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
+ return 0;
+ }
+ if (respid <= 0) {
+ ast_log(LOG_WARNING, "Invalid SIP response code: '%d'\n", respid);
+ return 0;
+ }
+ if (p->ocseq && (p->ocseq < seqno)) {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
+ return -1;
+ } else {
+ if ((respid == 200) || ((respid >= 300) && (respid <= 399))) {
+ extract_uri(p, req);
+>>>>>>> .merge-right.r211551
}
}
return 0;
@@ -19203,7 +19224,7 @@ static int sip_parse_host(char *line, int lineno, char **hostname, int *portnum,
if ((port = strrchr(line, ':'))) {
*port++ = '\0';
- if (!sscanf(port, "%u", portnum)) {
+ if (!sscanf(port, "%5u", portnum)) {
ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", port, lineno);
port = NULL;
}
@@ -19610,7 +19631,7 @@ int parse_minse (const char *p_hdrval, int *const p_interval)
*p_interval = 0;
p_hdrval = ast_skip_blanks(p_hdrval);
- if (!sscanf(p_hdrval, "%d", p_interval)) {
+ if (!sscanf(p_hdrval, "%30d", p_interval)) {
ast_log(LOG_WARNING, "Parsing of Min-SE header failed %s\n", p_hdrval);
return -1;
}
@@ -19640,7 +19661,7 @@ int parse_session_expires(const char *p_hdrval, int *const p_interval, enum st_r
while ((p_token = strsep(&p_se_hdr, ";"))) {
p_token = ast_skip_blanks(p_token);
- if (!sscanf(p_token, "%d", p_interval)) {
+ if (!sscanf(p_token, "%30d", p_interval)) {
ast_log(LOG_WARNING, "Parsing of Session-Expires failed\n");
return -1;
}
@@ -20605,19 +20626,19 @@ static struct sip_user *build_user(const char *name, struct ast_variable *v, str
user->stimer.st_mode_oper = i;
}
} else if (!strcasecmp(v->name, "session-expires")) {
- if (sscanf(v->value, "%d", &user->stimer.st_max_se) != 1) {
+ if (sscanf(v->value, "%30d", &user->stimer.st_max_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-expires '%s' at line %d of %s\n", v->value, v->lineno, config);
user->stimer.st_max_se = global_max_se;
- }
+ }
} else if (!strcasecmp(v->name, "session-minse")) {
- if (sscanf(v->value, "%d", &user->stimer.st_min_se) != 1) {
+ if (sscanf(v->value, "%30d", &user->stimer.st_min_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-minse '%s' at line %d of %s\n", v->value, v->lineno, config);
user->stimer.st_min_se = global_min_se;
- }
+ }
if (user->stimer.st_min_se < 90) {
ast_log(LOG_WARNING, "session-minse '%s' at line %d of %s is not allowed to be < 90 secs\n", v->value, v->lineno, config);
user->stimer.st_min_se = global_min_se;
- }
+ }
} else if (!strcasecmp(v->name, "session-refresher")) {
int i = (int) str2strefresher(v->value);
if (i < 0) {
@@ -20829,7 +20850,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
} else if (realtime && !strcasecmp(v->name, "regseconds")) {
ast_get_time_t(v->value, &regseconds, 0, NULL);
} else if (realtime && !strcasecmp(v->name, "lastms")) {
- sscanf(v->value, "%d", &peer->lastms);
+ sscanf(v->value, "%30d", &peer->lastms);
} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
inet_aton(v->value, &(peer->addr.sin_addr));
} else if (realtime && !strcasecmp(v->name, "name"))
@@ -21000,22 +21021,22 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
} else if (!strcasecmp(v->name, "autoframing")) {
peer->autoframing = ast_true(v->value);
} else if (!strcasecmp(v->name, "rtptimeout")) {
- if ((sscanf(v->value, "%d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
peer->rtptimeout = global_rtptimeout;
}
} else if (!strcasecmp(v->name, "rtpholdtimeout")) {
- if ((sscanf(v->value, "%d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
peer->rtpholdtimeout = global_rtpholdtimeout;
}
} else if (!strcasecmp(v->name, "rtpkeepalive")) {
- if ((sscanf(v->value, "%d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
peer->rtpkeepalive = global_rtpkeepalive;
}
} else if (!strcasecmp(v->name, "timert1")) {
- if ((sscanf(v->value, "%d", &peer->timer_t1) != 1) || (peer->timer_t1 < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->timer_t1) != 1) || (peer->timer_t1 < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid T1 time at line %d. Using default.\n", v->value, v->lineno);
peer->timer_t1 = global_t1;
}
@@ -21025,7 +21046,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->timer_b = peer->timer_t1 * 64;
}
} else if (!strcasecmp(v->name, "timerb")) {
- if ((sscanf(v->value, "%d", &peer->timer_b) != 1) || (peer->timer_b < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->timer_b) != 1) || (peer->timer_b < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid Timer B time at line %d. Using default.\n", v->value, v->lineno);
peer->timer_b = global_timer_b;
}
@@ -21042,7 +21063,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = default_qualify ? default_qualify : DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno);
peer->maxms = 0;
}
@@ -21056,7 +21077,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
}
} else if (!strcasecmp(v->name, "qualifyfreq")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1)
+ if (sscanf(v->value, "%30d", &i) == 1)
peer->qualifyfreq = i * 1000;
else {
ast_log(LOG_WARNING, "Invalid qualifyfreq number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -21075,12 +21096,12 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->stimer.st_mode_oper = i;
}
} else if (!strcasecmp(v->name, "session-expires")) {
- if (sscanf(v->value, "%d", &peer->stimer.st_max_se) != 1) {
+ if (sscanf(v->value, "%30d", &peer->stimer.st_max_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-expires '%s' at line %d of %s\n", v->value, v->lineno, config);
peer->stimer.st_max_se = global_max_se;
}
} else if (!strcasecmp(v->name, "session-minse")) {
- if (sscanf(v->value, "%d", &peer->stimer.st_min_se) != 1) {
+ if (sscanf(v->value, "%30d", &peer->stimer.st_min_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-minse '%s' at line %d of %s\n", v->value, v->lineno, config);
peer->stimer.st_min_se = global_min_se;
}
@@ -21489,17 +21510,17 @@ static int reload_config(enum channelreloadreason reason)
} else if (!strcasecmp(v->name, "vmexten")) {
ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten));
} else if (!strcasecmp(v->name, "rtptimeout")) {
- if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtptimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpholdtimeout")) {
- if ((sscanf(v->value, "%d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtpholdtimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpkeepalive")) {
- if ((sscanf(v->value, "%d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
global_rtpkeepalive = 0;
}
@@ -21637,7 +21658,7 @@ static int reload_config(enum channelreloadreason reason)
if (!externip.sin_port)
externip.sin_port = bindaddr.sin_port;
} else if (!strcasecmp(v->name, "externrefresh")) {
- if (sscanf(v->value, "%d", &externrefresh) != 1) {
+ if (sscanf(v->value, "%30d", &externrefresh) != 1) {
ast_log(LOG_WARNING, "Invalid externrefresh value '%s', must be an integer >0 at line %d\n", v->value, v->lineno);
externrefresh = 10;
}
@@ -21697,7 +21718,7 @@ static int reload_config(enum channelreloadreason reason)
ast_log(LOG_WARNING, "Invalid cos_text value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "bindport")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1) {
+ if (sscanf(v->value, "%5d", &i) == 1) {
bindaddr.sin_port = htons(i);
} else {
ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -21707,13 +21728,13 @@ static int reload_config(enum channelreloadreason reason)
default_qualify = 0;
} else if (!strcasecmp(v->value, "yes")) {
default_qualify = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &default_qualify) != 1) {
+ } else if (sscanf(v->value, "%30d", &default_qualify) != 1) {
ast_log(LOG_WARNING, "Qualification default should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", v->lineno);
default_qualify = 0;
}
} else if (!strcasecmp(v->name, "qualifyfreq")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1)
+ if (sscanf(v->value, "%30d", &i) == 1)
global_qualifyfreq = i * 1000;
else {
ast_log(LOG_WARNING, "Invalid qualifyfreq number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -21736,12 +21757,12 @@ static int reload_config(enum channelreloadreason reason)
global_st_mode = i;
}
} else if (!strcasecmp(v->name, "session-expires")) {
- if (sscanf(v->value, "%d", &global_max_se) != 1) {
+ if (sscanf(v->value, "%30d", &global_max_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-expires '%s' at line %d of %s\n", v->value, v->lineno, config);
global_max_se = DEFAULT_MAX_SE;
}
} else if (!strcasecmp(v->name, "session-minse")) {
- if (sscanf(v->value, "%d", &global_min_se) != 1) {
+ if (sscanf(v->value, "%30d", &global_min_se) != 1) {
ast_log(LOG_WARNING, "Invalid session-minse '%s' at line %d of %s\n", v->value, v->lineno, config);
global_min_se = DEFAULT_MIN_SE;
}
@@ -22329,7 +22350,7 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
memset(lport, 0, sizeof(lport));
localtmp++;
/* This is okey because lhost and lport are as big as tmp */
- sscanf(localtmp, "%[^<>:; ]:%[^<>:; ]", lhost, lport);
+ sscanf(localtmp, "%80[^<>:; ]:%80[^<>:; ]", lhost, lport);
if (ast_strlen_zero(lhost)) {
ast_log(LOG_ERROR, "Can't find the host address\n");
return 0;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 7cf9a7faa..35b7e62fd 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -5946,7 +5946,7 @@ static int reload_config(void)
} else if (!strcasecmp(v->name, "disallow")) {
ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 0);
} else if (!strcasecmp(v->name, "bindport")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%5d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
} else {
ast_log(LOG_WARNING, "Invalid bindport '%s' at line %d of %s\n", v->value, v->lineno, config);
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
index 11d297ff9..975bf72f2 100644
--- a/channels/chan_usbradio.c
+++ b/channels/chan_usbradio.c
@@ -259,8 +259,8 @@ END_CONFIG
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
-static char *config = "usbradio.conf"; /* default config file */
-static char *config1 = "usbradio_tune.conf"; /* tune config file */
+static const char *config = "usbradio.conf"; /* default config file */
+static const char *config1 = "usbradio_tune.conf"; /* tune config file */
static FILE *frxcapraw = NULL, *frxcaptrace = NULL, *frxoutraw = NULL;
static FILE *ftxcapraw = NULL, *ftxcaptrace = NULL, *ftxoutraw = NULL;
@@ -1797,7 +1797,7 @@ static void store_rxsdtype(struct chan_usbradio_pvt *o, const char *s)
static void store_rxgain(struct chan_usbradio_pvt *o, const char *s)
{
float f;
- if (sscanf(s, "%f", &f) == 1)
+ if (sscanf(s, "%30f", &f) == 1)
o->rxgain = f;
ast_debug(4, "set rxgain = %f\n", f);
}
@@ -1805,7 +1805,7 @@ static void store_rxgain(struct chan_usbradio_pvt *o, const char *s)
static void store_rxvoiceadj(struct chan_usbradio_pvt *o, const char *s)
{
float f;
- if (sscanf(s, "%f", &f) == 1)
+ if (sscanf(s, "%30f", &f) == 1)
o->rxvoiceadj = f;
ast_debug(4, "set rxvoiceadj = %f\n", f);
}
@@ -1813,7 +1813,7 @@ static void store_rxvoiceadj(struct chan_usbradio_pvt *o, const char *s)
static void store_rxctcssadj(struct chan_usbradio_pvt *o, const char *s)
{
float f;
- if (sscanf(s, "%f", &f) == 1)
+ if (sscanf(s, "%30f", &f) == 1)
o->rxctcssadj = f;
ast_debug(4, "set rxctcssadj = %f\n", f);
}
diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c
index b56e7798b..8d2dfd9f2 100644
--- a/channels/iax2-provision.c
+++ b/channels/iax2-provision.c
@@ -261,7 +261,7 @@ int iax_provision_version(unsigned int *version, const char *template, int force
ast_mutex_lock(&provlock);
ast_db_get("iax/provisioning/cache", template, tmp, sizeof(tmp));
- if (sscanf(tmp, "v%x", version) != 1) {
+ if (sscanf(tmp, "v%30x", version) != 1) {
if (strcmp(tmp, "u")) {
ret = iax_provision_build(&ied, version, template, force);
if (ret)
@@ -319,7 +319,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
v = ast_variable_browse(cfg, s);
while(v) {
if (!strcasecmp(v->name, "port") || !strcasecmp(v->name, "serverport")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < 65535)) {
+ if ((sscanf(v->value, "%5d", &x) == 1) && (x > 0) && (x < 65535)) {
if (!strcasecmp(v->name, "port")) {
cur->port = x;
foundportno = 1;
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index 1db51f94f..20ed2e352 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -889,9 +889,9 @@ static int _parse (union misdn_cfg_pt *dest, const char *value, enum misdn_cfg_t
int res;
if (strchr(value,'x')) {
- res = sscanf(value, "%x", &tmp);
+ res = sscanf(value, "%30x", &tmp);
} else {
- res = sscanf(value, "%d", &tmp);
+ res = sscanf(value, "%30d", &tmp);
}
if (res) {
dest->num = ast_malloc(sizeof(int));
@@ -906,7 +906,7 @@ static int _parse (union misdn_cfg_pt *dest, const char *value, enum misdn_cfg_t
break;
case MISDN_CTYPE_BOOLINT:
dest->num = ast_malloc(sizeof(int));
- if (sscanf(value, "%d", &tmp)) {
+ if (sscanf(value, "%30d", &tmp)) {
memcpy(dest->num, &tmp, sizeof(int));
} else {
*(dest->num) = (ast_true(value) ? boolint_def : 0);
@@ -975,7 +975,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
for (token = strsep(&tmp, ","); token; token = strsep(&tmp, ","), *ptpbuf = 0) {
if (!*token)
continue;
- if (sscanf(token, "%d-%d%s", &start, &end, ptpbuf) >= 2) {
+ if (sscanf(token, "%30d-%30d%511s", &start, &end, ptpbuf) >= 2) {
for (; start <= end; start++) {
if (start <= max_ports && start > 0) {
cfg_for_ports[start] = 1;
@@ -984,7 +984,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
CLI_ERROR(v->name, v->value, cat);
}
} else {
- if (sscanf(token, "%d%s", &start, ptpbuf)) {
+ if (sscanf(token, "%30d%511s", &start, ptpbuf)) {
if (start <= max_ports && start > 0) {
cfg_for_ports[start] = 1;
ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0;