aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 19:20:57 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 19:20:57 +0000
commitd1ec1aa57d296243d584ad268d8e61d7d1998569 (patch)
tree2596a6cb913ad8bd78e4670d298dc1d4682b2d23 /channels
parent4548c33d84f71a04a0416a26b9f0dea0ae061cc4 (diff)
AST-2009-005
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211539 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c8
-rw-r--r--channels/chan_dahdi.c40
-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.c144
-rw-r--r--channels/chan_skinny.c4
-rw-r--r--channels/chan_usbradio.c32
-rw-r--r--channels/iax2-provision.c4
-rw-r--r--channels/misdn_config.c10
-rw-r--r--channels/sig_pri.c8
-rwxr-xr-xchannels/xpmr/xpmr.c6
14 files changed, 145 insertions, 139 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index a31a12fdf..d0605eb50 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1346,9 +1346,9 @@ static struct ast_channel *agent_request(const char *type, int format, const str
struct timeval now;
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
@@ -2174,9 +2174,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 ee05f9539..4a44985af 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -4658,7 +4658,7 @@ static void destroy_all_channels(void)
snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, pl->span, x);
if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
- sscanf(db_answer, "%c:%d", &state, &why);
+ sscanf(db_answer, "%1c:%30d", &state, &why);
}
if (!why) {
/* SRVST persistence is not required */
@@ -5658,7 +5658,7 @@ static int parse_buffers_policy(const char *parse, int *num_buffers, int *policy
int res;
char policy_str[21] = "";
- if ((res = sscanf(parse, "%d,%20s", num_buffers, policy_str)) != 2) {
+ if ((res = sscanf(parse, "%30d,%20s", num_buffers, policy_str)) != 2) {
ast_log(LOG_WARNING, "Parsing buffer string '%s' failed.\n", parse);
return 1;
}
@@ -10270,7 +10270,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)
@@ -11274,7 +11274,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, const str
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;
}
@@ -11309,7 +11309,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, const str
x = CHAN_PSEUDO;
channelmatch = x;
}
- else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+ else if ((res = sscanf(s, "%30d%1c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data);
return NULL;
} else {
@@ -12640,7 +12640,7 @@ static char *handle_pri_service_generic(struct ast_cli_entry *e, int cmd, struct
if (a->argc < 5 || a->argc > 6)
return CLI_SHOWUSAGE;
if ((c = strchr(a->argv[4], ':'))) {
- if (sscanf(a->argv[4], "%d:%d", &trunkgroup, &channel) != 2)
+ if (sscanf(a->argv[4], "%30d:%30d", &trunkgroup, &channel) != 2)
return CLI_SHOWUSAGE;
if ((trunkgroup < 1) || (channel < 1))
return CLI_SHOWUSAGE;
@@ -12685,7 +12685,7 @@ static char *handle_pri_service_generic(struct ast_cli_entry *e, int cmd, struct
why = -1;
snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, tmp->span, channel);
if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
- sscanf(db_answer, "%c:%d", &state, &why);
+ sscanf(db_answer, "%1c:%30d", &state, &why);
ast_db_del(db_chan_name, SRVST_DBKEY);
}
switch(changestatus) {
@@ -14850,9 +14850,9 @@ static int build_channels(struct dahdi_chan_conf *conf, const char *value, int r
c = ast_strdupa(value);
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")) {
@@ -14932,7 +14932,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;
}
@@ -15000,11 +15000,11 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
} 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")) {
@@ -15061,7 +15061,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
} else if (!strcasecmp(v->name, "busycount")) {
confp->chan.busycount = atoi(v->value);
} else if (!strcasecmp(v->name, "busypattern")) {
- if (sscanf(v->value, "%d,%d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
+ if (sscanf(v->value, "%30d,%30d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength at line %d.\n", v->lineno);
}
} else if (!strcasecmp(v->name, "callprogress")) {
@@ -15081,7 +15081,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
} 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 {
@@ -15165,19 +15165,19 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
confp->chan.mwimonitor_fsk = 1;
}
} 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")) {
@@ -15743,7 +15743,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
ast_copy_string(original_args, v->value, sizeof(original_args));
/* 16 cadences allowed (8 pairs) */
- element_count = sscanf(v->value, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
+ element_count = sscanf(v->value, "%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
/* Cadence must be even (on/off) */
if (element_count % 2 == 1) {
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 381c99502..1ef01452c 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -11072,18 +11072,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")) {
@@ -11720,7 +11720,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 8adaf12a3..d74fc9daf 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1866,7 +1866,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;
}
@@ -1881,7 +1881,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_rtp_codecs_payloads_clear(ast_rtp_instance_get_codecs(sub->rtp), 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);
@@ -1897,7 +1897,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_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(sub->rtp), sub->rtp, codec, "audio", mimeSubtype, 0);
@@ -2030,7 +2030,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);
@@ -3259,7 +3259,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) {
@@ -3317,7 +3317,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) {
@@ -4142,7 +4142,7 @@ static int reload_config(int reload)
if (ast_str2cos(v->value, &qos.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 a85392eed..a26bdacd6 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -3979,7 +3979,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 a58c4b6d4..d7b6cc3f4 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1235,7 +1235,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 d3131210c..6e0029199 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 ef470bd46..638a381d8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2924,7 +2924,7 @@ static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_sessi
copy_request(&reqcpy, &req);
parse_request(&reqcpy);
/* In order to know how much to read, we need the content-length header */
- 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)) {
@@ -3754,7 +3754,7 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res
p->packets = pkt; /* Add it to the queue */
if (resp) {
/* Parse out the response code */
- if (sscanf(ast_str_buffer(pkt->data), "SIP/2.0 %d", &respid) == 1) {
+ if (sscanf(ast_str_buffer(pkt->data), "SIP/2.0 %30d", &respid) == 1) {
pkt->response_code = respid;
}
}
@@ -3805,10 +3805,10 @@ static int __sip_autodestruct(const void *data)
/* If there are packets still waiting for delivery, delay the destruction */
if (p->packets) {
if (!p->needdestroy) {
- char method_str[30];
+ char method_str[31];
ast_debug(3, "Re-scheduled destruction of SIP call %s\n", p->callid ? p->callid : "<unknown>");
append_history(p, "ReliableXmit", "timeout");
- if (sscanf(p->lastmsg, "Tx: %s", method_str) == 1 || sscanf(p->lastmsg, "Rx: %s", method_str) == 1) {
+ if (sscanf(p->lastmsg, "Tx: %30s", method_str) == 1 || sscanf(p->lastmsg, "Rx: %30s", method_str) == 1) {
if (method_match(SIP_CANCEL, method_str) || method_match(SIP_BYE, method_str)) {
pvt_set_needdestroy(p, "autodestruct");
}
@@ -5215,7 +5215,7 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer, struct sockadd
/* This address should be updated using dnsmgr */
memcpy(&dialog->sa.sin_addr, &sin->sin_addr, sizeof(dialog->sa.sin_addr));
if (!sin->sin_port) {
- if (ast_strlen_zero(port) || sscanf(port, "%u", &portno) != 1) {
+ if (ast_strlen_zero(port) || sscanf(port, "%30u", &portno) != 1) {
portno = (dialog->socket.type & SIP_TRANSPORT_TLS) ?
STANDARD_TLS_PORT : STANDARD_SIP_PORT;
}
@@ -7771,7 +7771,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;
}
@@ -7876,10 +7876,10 @@ static int get_ip_and_port_from_sdp(struct sip_request *req, const enum media_ty
}
/* We only want the m and c lines for audio */
for (m = get_sdp_iterate(&miterator, req, "m"); !ast_strlen_zero(m); m = get_sdp_iterate(&miterator, req, "m")) {
- if ((media == SDP_AUDIO && ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1 && len > 0))) ||
- (media == SDP_VIDEO && ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
- (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1 && len > 0)))) {
+ if ((media == SDP_AUDIO && ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1 && len > 0))) ||
+ (media == SDP_VIDEO && ((sscanf(m, "video %30d/%30d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+ (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1 && len > 0)))) {
/* See if there's a c= line for this media stream.
* XXX There is no guarantee that we'll be grabbing the c= line for this
* particular media stream here. However, this is the same logic used in process_sdp.
@@ -8016,7 +8016,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_log(LOG_WARNING, "SDP syntax error in o= line\n");
return -1;
}
- if (!sscanf(token, "%" SCNd64, &rua_version)) {
+ if (!sscanf(token, "%30" SCNd64, &rua_version)) {
ast_log(LOG_WARNING, "SDP syntax error in o= line version\n");
return -1;
}
@@ -8102,8 +8102,8 @@ 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;
p->offered_media[SDP_AUDIO].offered = TRUE;
numberofmediastreams++;
@@ -8113,7 +8113,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
codecs = m + len;
ast_copy_string(p->offered_media[SDP_AUDIO].text, codecs, sizeof(p->offered_media[SDP_AUDIO].text));
for (; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -8122,8 +8122,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_rtp_codecs_payloads_set_m_type(&newaudiortp, NULL, 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;
p->offered_media[SDP_VIDEO].offered = TRUE;
@@ -8133,7 +8133,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
codecs = m + len;
ast_copy_string(p->offered_media[SDP_VIDEO].text, codecs, sizeof(p->offered_media[SDP_VIDEO].text));
for (; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -8141,8 +8141,8 @@ 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_codecs_payloads_set_m_type(&newvideortp, NULL, 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->offered_media[SDP_TEXT].offered = TRUE;
p->notext = FALSE;
@@ -8152,7 +8152,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
codecs = m + len;
ast_copy_string(p->offered_media[SDP_TEXT].text, codecs, sizeof(p->offered_media[SDP_TEXT].text));
for (; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -8160,8 +8160,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_codecs_payloads_set_m_type(&newtextrtp, NULL, codec);
}
- } else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1 && len > 0) ||
- (sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
+ } else if (p->udptl && ( (sscanf(m, "image %30d udptl t38%n", &x, &len) == 1 && len > 0) ||
+ (sscanf(m, "image %30d UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
if (debug)
ast_verbose("Got T.38 offer in SDP in dialog %s\n", p->callid);
p->offered_media[SDP_IMAGE].offered = TRUE;
@@ -8358,17 +8358,17 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
red_cp = &red_fmtp[strlen(red_fmtp)];
strncpy(red_fmtp, a, 100);
- sscanf(red_cp, "%u", &red_data_pt[red_num_gen]);
+ sscanf(red_cp, "%30u", &red_data_pt[red_num_gen]);
red_cp = strtok(red_cp, "/");
while (red_cp && red_num_gen++ < AST_RED_MAX_GENERATION) {
- sscanf(red_cp, "%u", &red_data_pt[red_num_gen]);
+ sscanf(red_cp, "%30u", &red_data_pt[red_num_gen]);
red_cp = strtok(NULL, "/");
}
red_cp = red_fmtp;
continue;
}
- if (sscanf(a, "fmtp: %u %63s", &codec, fmtp_string) == 2) {
+ if (sscanf(a, "fmtp: %30u %63s", &codec, fmtp_string) == 2) {
struct ast_rtp_payload_type payload;
unsigned int handled = 0;
@@ -8382,7 +8382,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
switch (payload.code) {
case AST_FORMAT_SIREN7:
- if (sscanf(fmtp_string, "bitrate=%u", &bit_rate) == 1) {
+ if (sscanf(fmtp_string, "bitrate=%30u", &bit_rate) == 1) {
if (bit_rate != 32000) {
ast_log(LOG_WARNING, "Got Siren7 offer at %d bps, but only 32000 bps supported; ignoring.\n", bit_rate);
ast_rtp_codecs_payloads_unset(&newaudiortp, NULL, codec);
@@ -8392,7 +8392,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
}
break;
case AST_FORMAT_SIREN14:
- if (sscanf(fmtp_string, "bitrate=%u", &bit_rate) == 1) {
+ if (sscanf(fmtp_string, "bitrate=%30u", &bit_rate) == 1) {
if (bit_rate != 48000) {
ast_log(LOG_WARNING, "Got Siren14 offer at %d bps, but only 48000 bps supported; ignoring.\n", bit_rate);
ast_rtp_codecs_payloads_unset(&newaudiortp, NULL, codec);
@@ -8410,7 +8410,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
continue;
}
- if (sscanf(a, "rtpmap: %u %127[^/]/%u", &codec, mimeSubtype, &sample_rate) == 3) {
+ if (sscanf(a, "rtpmap: %30u %127[^/]/%30u", &codec, mimeSubtype, &sample_rate) == 3) {
/* We have a rtpmap to handle */
if (last_rtpmap_codec < SDP_MAX_RTPMAP_CODECS) {
@@ -8472,10 +8472,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) {
@@ -8498,17 +8498,17 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
p->t38.their_parms.rate = AST_T38_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);
p->t38.their_parms.version = x;
- } 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);
} 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) {
p->t38.their_parms.fill_bit_removal = TRUE;
@@ -8519,7 +8519,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) {
p->t38.their_parms.transcoding_mmr = TRUE;
@@ -8530,7 +8530,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) {
p->t38.their_parms.transcoding_jbig = TRUE;
@@ -9297,7 +9297,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;
}
@@ -9473,7 +9473,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;
}
@@ -10185,7 +10185,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;
}
@@ -10230,7 +10230,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;
}
@@ -12103,7 +12103,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", &expire) != 1)
+ if (sscanf(expires + 9, "%30d", &expire) != 1)
expire = default_expiry;
} else {
/* Nothing has been specified */
@@ -17149,7 +17149,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;
}
@@ -18331,7 +18331,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, const char *res
}
tmptmp = strcasestr(contact, "expires=");
if (tmptmp) {
- if (sscanf(tmptmp + 8, "%d;", &expires) != 1)
+ if (sscanf(tmptmp + 8, "%30d;", &expires) != 1)
expires = 0;
}
@@ -21832,7 +21832,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;
}
@@ -21863,7 +21863,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so
if (ast_strlen_zero(e)) {
return 0;
}
- if (sscanf(e, "%d %n", &respid, &len) != 1) {
+ if (sscanf(e, "%30d %n", &respid, &len) != 1) {
ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
return 0;
}
@@ -22427,7 +22427,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;
}
@@ -22831,7 +22831,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;
}
@@ -22861,7 +22861,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;
}
@@ -23957,7 +23957,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"))
@@ -24160,22 +24160,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;
}
@@ -24185,7 +24185,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;
}
@@ -24206,7 +24206,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;
}
@@ -24220,7 +24220,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);
@@ -24239,12 +24239,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;
}
@@ -24728,17 +24728,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 = DEFAULT_RTPKEEPALIVE;
}
@@ -24886,7 +24886,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;
}
@@ -24950,28 +24950,28 @@ 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);
}
} else if (!strcasecmp(v->name, "hash_user")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1 && i > 2) {
+ if (sscanf(v->value, "%30d", &i) == 1 && i > 2) {
hash_user_size = i;
} else {
ast_log(LOG_WARNING, "Invalid hash_user size '%s' at line %d of %s -- should be much larger than 2\n", v->value, v->lineno, config);
}
} else if (!strcasecmp(v->name, "hash_peer")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1 && i > 2) {
+ if (sscanf(v->value, "%30d", &i) == 1 && i > 2) {
hash_peer_size = i;
} else {
ast_log(LOG_WARNING, "Invalid hash_peer size '%s' at line %d of %s -- should be much larger than 2\n", v->value, v->lineno, config);
}
} else if (!strcasecmp(v->name, "hash_dialog")) {
int i;
- if (sscanf(v->value, "%d", &i) == 1 && i > 2) {
+ if (sscanf(v->value, "%30d", &i) == 1 && i > 2) {
hash_dialog_size = i;
} else {
ast_log(LOG_WARNING, "Invalid hash_dialog size '%s' at line %d of %s -- should be much larger than 2\n", v->value, v->lineno, config);
@@ -24981,13 +24981,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);
@@ -25012,12 +25012,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;
}
@@ -25034,12 +25034,12 @@ static int reload_config(enum channelreloadreason reason)
global_st_refresher = i;
}
} else if (!strcasecmp(v->name, "qualifygap")) {
- if (sscanf(v->value, "%d", &global_qualify_gap) != 1) {
+ if (sscanf(v->value, "%30d", &global_qualify_gap) != 1) {
ast_log(LOG_WARNING, "Invalid qualifygap '%s' at line %d of %s\n", v->value, v->lineno, config);
global_qualify_gap = DEFAULT_QUALIFY_GAP;
}
} else if (!strcasecmp(v->name, "qualifypeers")) {
- if (sscanf(v->value, "%d", &global_qualify_peers) != 1) {
+ if (sscanf(v->value, "%30d", &global_qualify_peers) != 1) {
ast_log(LOG_WARNING, "Invalid pokepeers '%s' at line %d of %s\n", v->value, v->lineno, config);
global_qualify_peers = DEFAULT_QUALIFY_PEERS;
}
@@ -25663,7 +25663,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 86f3a7e3f..c289f3015 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -6689,7 +6689,7 @@ static struct ast_channel *skinny_request(const char *type, int format, const st
ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
continue;
} 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);
@@ -7166,7 +7166,7 @@ static struct ast_channel *skinny_request(const char *type, int format, const st
/* load the general section */
cat = ast_category_browse(cfg, "general");
config_parse_variables(TYPE_GENERAL, NULL, ast_variable_browse(cfg, "general"));
-
+
if (ntohl(bindaddr.sin_addr.s_addr)) {
__ourip = bindaddr.sin_addr;
} else {
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
index dd1933483..088855702 100644
--- a/channels/chan_usbradio.c
+++ b/channels/chan_usbradio.c
@@ -351,8 +351,8 @@ END_CONFIG
#define DEV_DSP "/dev/dsp"
#endif
-static char *config = "usbradio.conf"; /* default config file */
-static char *config1 = "usbradio_tune_%s.conf"; /* tune config file */
+static const char *config = "usbradio.conf"; /* default config file */
+#define config1 "usbradio_tune_%s.conf" /* tune config file */
static FILE *frxcapraw = NULL, *frxcaptrace = NULL, *frxoutraw = NULL;
static FILE *ftxcapraw = NULL, *ftxcaptrace = NULL, *ftxoutraw = NULL;
@@ -1642,7 +1642,7 @@ static int usbradio_text(struct ast_channel *c, const char *text)
/* print received messages */
if(o->debuglevel)ast_verbose(" << Console Received usbradio text %s >> \n", text);
- cnt=sscanf(text,"%s %s %s %s %s %c",cmd,rxs,txs,rxpl,txpl,&pwr);
+ cnt = sscanf(text, "%300s %15s %15s %15s %15s %1c", cmd, rxs, txs, rxpl, txpl, &pwr);
if (strcmp(cmd,"SETCHAN")==0)
{
@@ -2812,7 +2812,7 @@ static void store_rxsdtype(struct chan_usbradio_pvt *o, char *s)
static void store_rxgain(struct chan_usbradio_pvt *o, char *s)
{
float f;
- sscanf(s,"%f",&f);
+ sscanf(s, "%30f", &f);
o->rxgain = f;
//ast_log(LOG_WARNING, "set rxgain = %f\n", f);
}
@@ -2821,7 +2821,7 @@ static void store_rxgain(struct chan_usbradio_pvt *o, char *s)
static void store_rxvoiceadj(struct chan_usbradio_pvt *o, char *s)
{
float f;
- sscanf(s,"%f",&f);
+ sscanf(s, "%30f", &f);
o->rxvoiceadj = f;
//ast_log(LOG_WARNING, "set rxvoiceadj = %f\n", f);
}
@@ -2830,7 +2830,7 @@ static void store_rxvoiceadj(struct chan_usbradio_pvt *o, char *s)
static void store_rxctcssadj(struct chan_usbradio_pvt *o, char *s)
{
float f;
- sscanf(s,"%f",&f);
+ sscanf(s, "%30f", &f);
o->rxctcssadj = f;
//ast_log(LOG_WARNING, "set rxctcssadj = %f\n", f);
}
@@ -3815,6 +3815,8 @@ static char *res2cli(int r)
static char *handle_console_key(struct ast_cli_entry *e,
int cmd, struct ast_cli_args *a)
{
+ char *argv[] = { "radio", "key", NULL };
+
switch (cmd) {
case CLI_INIT:
e->command = "radio key";
@@ -3823,12 +3825,13 @@ static char *handle_console_key(struct ast_cli_entry *e,
case CLI_GENERATE:
return NULL;
}
- return res2cli(console_key(a->fd,a->argc,a->argv));
+ return res2cli(console_key(a->fd, 2, argv));
}
static char *handle_console_unkey(struct ast_cli_entry *e,
int cmd, struct ast_cli_args *a)
{
+ char *argv[] = { "radio", "unkey", NULL };
switch (cmd) {
case CLI_INIT:
e->command = "radio unkey";
@@ -3837,12 +3840,13 @@ static char *handle_console_unkey(struct ast_cli_entry *e,
case CLI_GENERATE:
return NULL;
}
- return res2cli(console_unkey(a->fd,a->argc,a->argv));
+ return res2cli(console_unkey(a->fd, 2, argv));
}
static char *handle_radio_tune(struct ast_cli_entry *e,
int cmd, struct ast_cli_args *a)
{
+ char *argv[5] = { "radio", "tune", a->argc > 2 ? (char *) a->argv[2] : NULL, a->argc > 3 ? (char *) a->argv[3] : NULL };
switch (cmd) {
case CLI_INIT:
e->command = "radio tune";
@@ -3851,7 +3855,7 @@ static char *handle_radio_tune(struct ast_cli_entry *e,
case CLI_GENERATE:
return NULL;
}
- return res2cli(radio_tune(a->fd,a->argc,a->argv));
+ return res2cli(radio_tune(a->fd, a->argc, argv));
}
static char *handle_radio_debug(struct ast_cli_entry *e,
@@ -3865,7 +3869,7 @@ static char *handle_radio_debug(struct ast_cli_entry *e,
case CLI_GENERATE:
return NULL;
}
- return res2cli(radio_set_debug(a->fd,a->argc,a->argv));
+ return res2cli(radio_set_debug(a->fd, a->argc, NULL /* ignored */));
}
static char *handle_radio_debug_off(struct ast_cli_entry *e,
@@ -3879,12 +3883,13 @@ static char *handle_radio_debug_off(struct ast_cli_entry *e,
case CLI_GENERATE:
return NULL;
}
- return res2cli(radio_set_debug_off(a->fd,a->argc,a->argv));
+ return res2cli(radio_set_debug_off(a->fd, a->argc, NULL /* ignored */));
}
static char *handle_radio_active(struct ast_cli_entry *e,
int cmd, struct ast_cli_args *a)
{
+ char *argv[4] = { "radio", "active", a->argc > 2 ? (char *) a->argv[2] : NULL, };
switch (cmd) {
case CLI_INIT:
e->command = "radio active";
@@ -3893,12 +3898,13 @@ static char *handle_radio_active(struct ast_cli_entry *e,
case CLI_GENERATE:
return NULL;
}
- return res2cli(radio_active(a->fd,a->argc,a->argv));
+ return res2cli(radio_active(a->fd, a->argc, argv));
}
static char *handle_set_xdebug(struct ast_cli_entry *e,
int cmd, struct ast_cli_args *a)
{
+ char *argv[5] = { "radio", "set", "xdebug", a->argc == 4 ? (char *) a->argv[3] : NULL, };
switch (cmd) {
case CLI_INIT:
e->command = "radio set xdebug";
@@ -3907,7 +3913,7 @@ static char *handle_set_xdebug(struct ast_cli_entry *e,
case CLI_GENERATE:
return NULL;
}
- return res2cli(radio_set_xpmr_debug(a->fd,a->argc,a->argv));
+ return res2cli(radio_set_xpmr_debug(a->fd, a->argc, argv));
}
diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c
index 4907f63b8..c7af9f324 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 70bc8a6c2..7318326f6 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -922,9 +922,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));
@@ -939,7 +939,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);
@@ -1008,7 +1008,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;
@@ -1017,7 +1017,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
CLI_ERROR(v->name, v->value, cat);
}
} else {
- if (sscanf(token, "%d%s", &start, ptpbuf)) {
+ if (sscanf(token, "%30d%511s", &start, ptpbuf)) {
if (start <= max_ports && start > 0) {
cfg_for_ports[start] = 1;
ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0;
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index 307dabe4e..755eb9985 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -516,7 +516,7 @@ tryanotherpos:
/* if so, try next channel */
if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
- sscanf(db_answer, "%c:%d", &state, &why);
+ sscanf(db_answer, "%1c:%30d", &state, &why);
if (why) {
ast_log(LOG_NOTICE, "span '%d' channel '%d' out-of-service (reason: %s), not sending RESTART\n", pri->span,
pri->pvts[pri->resetpos]->channel, (why & SRVST_FAREND) ? (why & SRVST_NEAREND) ? "both ends" : "far end" : "near end");
@@ -1014,7 +1014,7 @@ static void *pri_dchannel(void *vpri)
ast_mutex_unlock(&pri->pvts[chanpos]->service_lock);
if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
- sscanf(db_answer, "%c:%d", &state, &why);
+ sscanf(db_answer, "%1c:%30d", &state, &why);
if (why) {
ast_log(LOG_NOTICE, "span '%d' channel '%d' out-of-service (reason: %s), ignoring RESTART\n", pri->span,
e->restart.channel, (why & SRVST_FAREND) ? (why & SRVST_NEAREND) ? "both ends" : "far end" : "near end");
@@ -1126,7 +1126,7 @@ static void *pri_dchannel(void *vpri)
snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, pri->pvts[chanpos]->pri->span, ch);
if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
- sscanf(db_answer, "%c:%d", &state, &why);
+ sscanf(db_answer, "%1c:%30d", &state, &why);
ast_db_del(db_chan_name, SRVST_DBKEY);
}
switch (e->service.changestatus) {
@@ -2369,7 +2369,7 @@ int sig_pri_available(struct sig_pri_chan *p, int channelmatch, ast_group_t grou
snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, p->pri->span, p->channel);
if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
- sscanf(db_answer, "%c:%d", &state, &why);
+ sscanf(db_answer, "%1c:%30d", &state, &why);
}
if ((p->resetting || p->call) || (why)) {
if (why) {
diff --git a/channels/xpmr/xpmr.c b/channels/xpmr/xpmr.c
index 7c87410b2..b94b0faf9 100755
--- a/channels/xpmr/xpmr.c
+++ b/channels/xpmr/xpmr.c
@@ -279,11 +279,11 @@ i16 code_string_parse(t_pmr_chan *pChan)
if(!xpmrx(pChan,XXO_LSDCODEPARSE_1))
#endif
{
- sscanf(p,"%f",&_f);
+ sscanf(p, "%30f", &_f);
ri=CtcssFreqIndex(_f);
if(ri>maxctcssindex)maxctcssindex=ri;
- sscanf(pChan->pTxCode[i],"%f",&_f);
+ sscanf(pChan->pTxCode[i], "%30f", &_f);
_ti=CtcssFreqIndex(_f);
if(_f>maxctcsstxfreq)maxctcsstxfreq=_f;
@@ -350,7 +350,7 @@ i16 code_string_parse(t_pmr_chan *pChan)
if(!lsd_code_parse(pChan,3))
#endif
{
- sscanf(p,"%f",&f);
+ sscanf(p, "%30f", &f);
ti=CtcssFreqIndex(f);
if(f>maxctcsstxfreq)maxctcsstxfreq=f;