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_h323.c2
-rw-r--r--channels/chan_iax2.c10
-rw-r--r--channels/chan_mgcp.c16
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_modem.c6
-rw-r--r--channels/chan_phone.c2
-rw-r--r--channels/chan_sip.c56
-rw-r--r--channels/chan_skinny.c2
-rw-r--r--channels/chan_vpb.c2
-rw-r--r--channels/chan_zap.c32
-rw-r--r--channels/iax2-provision.c6
-rw-r--r--channels/misdn_config.c10
13 files changed, 77 insertions, 77 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 53d7d1067..87b49839a 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1296,9 +1296,9 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
struct timeval tv;
s = data;
- if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ if ((s[0] == '@') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
- } else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ } else if ((s[0] == ':') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
waitforagent = 1;
} else {
@@ -2405,9 +2405,9 @@ static int agent_devicestate(void *data)
int res = AST_DEVICE_INVALID;
s = data;
- if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ if ((s[0] == '@') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
- } else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
+ } else if ((s[0] == ':') && (sscanf(s + 1, "%30d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
waitforagent = 1;
} else {
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index b2d4d8184..082e5de46 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -2037,7 +2037,7 @@ int reload_config(void)
memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
}
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &format)) {
+ if (sscanf(v->value, "%30d", &format)) {
tos = format & 0xff;
} else if (!strcasecmp(v->value, "lowdelay")) {
tos = IPTOS_LOWDELAY;
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index dcae68853..daaa51a77 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -2814,7 +2814,7 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in
break;
}
} else if (!strcasecmp(tmp->name, "regseconds")) {
- if (sscanf(tmp->value, "%ld", (time_t *)&regseconds) != 1)
+ if (sscanf(tmp->value, "%30ld", (time_t *)&regseconds) != 1)
regseconds = 0;
} else if (!strcasecmp(tmp->name, "ipaddr")) {
inet_aton(tmp->value, &(peer->addr.sin_addr));
@@ -8787,18 +8787,18 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, in
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
peer->maxms = 0;
}
} else if (!strcasecmp(v->name, "qualifysmoothing")) {
peer->smoothing = ast_true(v->value);
} else if (!strcasecmp(v->name, "qualifyfreqok")) {
- if (sscanf(v->value, "%d", &peer->pokefreqok) != 1) {
+ if (sscanf(v->value, "%30d", &peer->pokefreqok) != 1) {
ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when OK should a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
}
} else if (!strcasecmp(v->name, "qualifyfreqnotok")) {
- if (sscanf(v->value, "%d", &peer->pokefreqnotok) != 1) {
+ if (sscanf(v->value, "%30d", &peer->pokefreqnotok) != 1) {
ast_log(LOG_WARNING, "Qualification testing frequency of peer '%s' when NOT OK should be a number of milliseconds at line %d of iax.conf\n", peer->name, v->lineno);
} else ast_log(LOG_WARNING, "Set peer->pokefreqnotok to %d\n", peer->pokefreqnotok);
} else if (!strcasecmp(v->name, "timezone")) {
@@ -9272,7 +9272,7 @@ static int set_config(char *config_file, int reload)
if (trunkfreq < 10)
trunkfreq = 10;
} else if (!strcasecmp(v->name, "autokill")) {
- if (sscanf(v->value, "%d", &x) == 1) {
+ if (sscanf(v->value, "%30d", &x) == 1) {
if (x >= 0)
autokill = x;
else
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index de2d6a400..482e868eb 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1793,7 +1793,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c);
return -1;
}
- if (sscanf(m, "audio %d RTP/AVP %n", &portno, &len) != 1) {
+ if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1) {
ast_log(LOG_WARNING, "Unable to determine port number for RTP in '%s'\n", m);
return -1;
}
@@ -1808,7 +1808,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_rtp_pt_clear(sub->rtp);
codecs = ast_strdupa(m + len);
while (!ast_strlen_zero(codecs)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
if (codec_count)
break;
ast_log(LOG_WARNING, "Error in codec string '%s' at '%s'\n", m, codecs);
@@ -1824,7 +1824,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
sdpLineNum_iterator_init(&iterator);
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
char* mimeSubtype = ast_strdupa(a); /* ensures we have enough space */
- if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2)
+ if (sscanf(a, "rtpmap: %30u %[^/]/", &codec, mimeSubtype) != 2)
continue;
/* Note: should really look at the 'freq' and '#chans' params too */
ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype);
@@ -1958,7 +1958,7 @@ static int transmit_response(struct mgcp_subchannel *sub, char *msg, struct mgcp
if (mgr) {
/* Store MGCP response in case we have to retransmit */
memset(mgr, 0, sizeof(struct mgcp_response));
- sscanf(req->identifier, "%d", &mgr->seqno);
+ sscanf(req->identifier, "%30d", &mgr->seqno);
time(&mgr->whensent);
mgr->len = resp.len;
memcpy(mgr->buf, resp.data, resp.len);
@@ -3246,7 +3246,7 @@ static int find_and_retrans(struct mgcp_subchannel *sub, struct mgcp_request *re
time_t now;
struct mgcp_response *prev = NULL, *cur, *next, *answer=NULL;
time(&now);
- if (sscanf(req->identifier, "%d", &seqno) != 1)
+ if (sscanf(req->identifier, "%30d", &seqno) != 1)
seqno = 0;
cur = sub->parent->parent->responses;
while(cur) {
@@ -3305,7 +3305,7 @@ static int mgcpsock_read(int *id, int fd, short events, void *ignore)
return 1;
}
- if (sscanf(req.verb, "%d", &result) && sscanf(req.identifier, "%d", &ident)) {
+ if (sscanf(req.verb, "%30d", &result) && sscanf(req.identifier, "%30d", &ident)) {
/* Try to find who this message is for, if it's important */
sub = find_subchannel_and_lock(NULL, ident, &sin);
if (sub) {
@@ -4119,7 +4119,7 @@ static int reload_config(void)
else
capability &= ~format;
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &format) == 1)
+ if (sscanf(v->value, "%30d", &format) == 1)
tos = format & 0xff;
else if (!strcasecmp(v->value, "lowdelay"))
tos = IPTOS_LOWDELAY;
@@ -4134,7 +4134,7 @@ static int reload_config(void)
else
ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
} else if (!strcasecmp(v->name, "port")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%30d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
} else {
ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index cf5ea13f6..8e4e8f9ac 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -787,7 +787,7 @@ static int misdn_show_config (int fd, int argc, char *argv[])
int onlyport = -1;
if (argc >= 4) {
- if (!sscanf(argv[3], "%d", &onlyport) || onlyport < 0) {
+ if (!sscanf(argv[3], "%30d", &onlyport) || onlyport < 0) {
ast_cli(fd, "Unknown option: %s\n", argv[3]);
return RESULT_SHOWUSAGE;
}
diff --git a/channels/chan_modem.c b/channels/chan_modem.c
index d95d175bb..a5d11c4a6 100644
--- a/channels/chan_modem.c
+++ b/channels/chan_modem.c
@@ -835,7 +835,7 @@ static struct ast_channel *modem_request(const char *type, int format, void *dat
if (dev[0]=='g' && isdigit(dev[1])) {
/* Retrieve the group number */
- if (sscanf(dev+1, "%u", &groupint) < 1) {
+ if (sscanf(dev+1, "%30u", &groupint) < 1) {
ast_log(LOG_WARNING, "Unable to determine group from [%s]\n", (char *)data);
return NULL;
}
@@ -898,9 +898,9 @@ static ast_group_t get_group(char *s)
stringp=copy;
piece = strsep(&stringp, ",");
while(piece) {
- if (sscanf(piece, "%d-%d", &start, &finish) == 2) {
+ if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) {
/* Range */
- } else if (sscanf(piece, "%d", &start)) {
+ } else if (sscanf(piece, "%30d", &start)) {
/* Just one */
finish = start;
} else {
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 54cadc208..1b9ac8309 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -1216,7 +1216,7 @@ static int parse_gain_value(char *gain_type, char *value)
float gain;
/* try to scan number */
- if (sscanf(value, "%f", &gain) != 1)
+ if (sscanf(value, "%30f", &gain) != 1)
{
ast_log(LOG_ERROR, "Invalid %s value '%s' in '%s' config\n",
value, gain_type, config);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d13e453c0..5ad323b7b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2095,7 +2095,7 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout)
res = 0;
ast_set_flag(p, SIP_OUTGOING);
#ifdef OSP_SUPPORT
- if (!p->options->osptoken || !osphandle || (sscanf(osphandle, "%d", &p->osphandle) != 1)) {
+ if (!p->options->osptoken || !osphandle || (sscanf(osphandle, "%30d", &p->osphandle) != 1)) {
/* Force Disable OSP support */
ast_log(LOG_DEBUG, "Disabling OSP support for this call. osptoken = %s, osphandle = %s\n", p->options->osptoken, osphandle);
p->options->osptoken = NULL;
@@ -3638,15 +3638,15 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
ast_set_flag(p, SIP_NOVIDEO);
while ((m = get_sdp_iterate(&iterator, req, "m"))[0] != '\0') {
int found = 0;
- if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &y, &len) == 2) ||
- (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) {
+ if ((sscanf(m, "audio %30d/%30d RTP/AVP %n", &x, &y, &len) == 2) ||
+ (sscanf(m, "audio %30d RTP/AVP %n", &x, &len) == 1)) {
found = 1;
portno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
ast_rtp_pt_clear(p->rtp);
codecs = m + len;
while(!ast_strlen_zero(codecs)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -3659,14 +3659,14 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
if (p->vrtp)
ast_rtp_pt_clear(p->vrtp); /* Must be cleared in case no m=video line exists */
- if (p->vrtp && (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) {
+ if (p->vrtp && (sscanf(m, "video %30d RTP/AVP %n", &x, &len) == 1)) {
found = 1;
ast_clear_flag(p, SIP_NOVIDEO);
vportno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
codecs = m + len;
while(!ast_strlen_zero(codecs)) {
- if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
+ if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
return -1;
}
@@ -3747,7 +3747,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
if (!strcasecmp(a, "sendrecv")) {
sendonly = 0;
}
- if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue;
+ if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) != 2) continue;
if (debug)
ast_verbose("Found description format %s\n", mimeSubtype);
/* Note: should really look at the 'freq' and '#chans' params too */
@@ -4324,7 +4324,7 @@ static int __transmit_response(struct sip_pvt *p, char *msg, struct sip_request
struct sip_request resp;
int seqno = 0;
- if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+ if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -4443,7 +4443,7 @@ static int transmit_response_with_auth(struct sip_pvt *p, char *msg, struct sip_
char tmp[512];
int seqno = 0;
- if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) {
+ if (reliable && (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1)) {
ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -4755,7 +4755,7 @@ static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_r
{
struct sip_request resp;
int seqno;
- if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) {
+ if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
return -1;
}
@@ -6078,7 +6078,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
char *ptr;
if ((ptr = strchr(expires, ';')))
*ptr = '\0';
- if (sscanf(expires + 9, "%d", &expiry) != 1)
+ if (sscanf(expires + 9, "%30d", &expiry) != 1)
expiry = default_expiry;
} else {
/* Nothing has been specified */
@@ -10103,7 +10103,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
}
tmptmp = strcasestr(contact, "expires=");
if (tmptmp) {
- if (sscanf(tmptmp + 8, "%d;", &expires) != 1)
+ if (sscanf(tmptmp + 8, "%30d;", &expires) != 1)
expires = 0;
}
@@ -11430,7 +11430,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
ast_log(LOG_ERROR, "Missing Cseq. Dropping this SIP message, it's incomplete.\n");
error = 1;
}
- if (!error && sscanf(cseq, "%d%n", &seqno, &len) != 1) {
+ if (!error && sscanf(cseq, "%30d%n", &seqno, &len) != 1) {
ast_log(LOG_ERROR, "No seqno in '%s'. Dropping incomplete message.\n", cmd);
error = 1;
}
@@ -11465,7 +11465,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
ignore=1;
} else if (e) {
e = ast_skip_blanks(e);
- if (sscanf(e, "%d %n", &respid, &len) != 1) {
+ if (sscanf(e, "%30d %n", &respid, &len) != 1) {
ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
} else {
/* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */
@@ -12659,7 +12659,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
}
if (realtime && !strcasecmp(v->name, "regseconds")) {
- if (sscanf(v->value, "%ld", (time_t *)&regseconds) != 1)
+ if (sscanf(v->value, "%30ld", (time_t *)&regseconds) != 1)
regseconds = 0;
} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
inet_aton(v->value, &(peer->addr.sin_addr));
@@ -12774,17 +12774,17 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
} else if (!strcasecmp(v->name, "disallow")) {
ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, 0);
} else if (!strcasecmp(v->name, "rtptimeout")) {
- if ((sscanf(v->value, "%d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
peer->rtptimeout = global_rtptimeout;
}
} else if (!strcasecmp(v->name, "rtpholdtimeout")) {
- if ((sscanf(v->value, "%d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
peer->rtpholdtimeout = global_rtpholdtimeout;
}
} else if (!strcasecmp(v->name, "rtpkeepalive")) {
- if ((sscanf(v->value, "%d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
+ if ((sscanf(v->value, "%30d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
peer->rtpkeepalive = global_rtpkeepalive;
}
@@ -12804,7 +12804,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno);
peer->maxms = 0;
}
@@ -12952,24 +12952,24 @@ static int reload_config(void)
} else if (!strcasecmp(v->name, "relaxdtmf")) {
relaxdtmf = ast_true(v->value);
} else if (!strcasecmp(v->name, "checkmwi")) {
- if ((sscanf(v->value, "%d", &global_mwitime) != 1) || (global_mwitime < 0)) {
+ if ((sscanf(v->value, "%30d", &global_mwitime) != 1) || (global_mwitime < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid MWI time setting at line %d. Using default (10).\n", v->value, v->lineno);
global_mwitime = DEFAULT_MWITIME;
}
} else if (!strcasecmp(v->name, "vmexten")) {
ast_copy_string(global_vmexten, v->value, sizeof(global_vmexten));
} else if (!strcasecmp(v->name, "rtptimeout")) {
- if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtptimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpholdtimeout")) {
- if ((sscanf(v->value, "%d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtpholdtimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpkeepalive")) {
- if ((sscanf(v->value, "%d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
+ if ((sscanf(v->value, "%30d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
global_rtpkeepalive = 0;
}
@@ -13001,7 +13001,7 @@ static int reload_config(void)
ast_log(LOG_WARNING, "Unable to locate host '%s'\n", v->value);
} else if (!strcasecmp(v->name, "outboundproxyport")) {
/* Port needs to be after IP */
- sscanf(v->value, "%d", &format);
+ sscanf(v->value, "%30d", &format);
outboundproxyip.sin_port = htons(format);
} else if (!strcasecmp(v->name, "autocreatepeer")) {
autocreatepeer = ast_true(v->value);
@@ -13058,7 +13058,7 @@ static int reload_config(void)
memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr));
time(&externexpire);
} else if (!strcasecmp(v->name, "externrefresh")) {
- if (sscanf(v->value, "%d", &externrefresh) != 1) {
+ if (sscanf(v->value, "%30d", &externrefresh) != 1) {
ast_log(LOG_WARNING, "Invalid externrefresh value '%s', must be an integer >0 at line %d\n", v->value, v->lineno);
externrefresh = 10;
}
@@ -13089,7 +13089,7 @@ static int reload_config(void)
if (ast_str2tos(v->value, &tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
} else if (!strcasecmp(v->name, "bindport")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%30d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
} else {
ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
@@ -13099,7 +13099,7 @@ static int reload_config(void)
default_qualify = 0;
} else if (!strcasecmp(v->value, "yes")) {
default_qualify = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &default_qualify) != 1) {
+ } else if (sscanf(v->value, "%30d", &default_qualify) != 1) {
ast_log(LOG_WARNING, "Qualification default should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", v->lineno);
default_qualify = 0;
}
@@ -13531,7 +13531,7 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
memset(lport, 0, sizeof(lport));
localtmp++;
/* This is okey because lhost and lport are as big as tmp */
- sscanf(localtmp, "%[^<>:; ]:%[^<>:; ]", lhost, lport);
+ sscanf(localtmp, "%80[^<>:; ]:%80[^<>:; ]", lhost, lport);
if (!strlen(lhost)) {
ast_log(LOG_ERROR, "Can't find the host address\n");
return 0;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index c9d3f8854..2c0d8d226 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -3125,7 +3125,7 @@ static int reload_config(void)
capability &= ~format;
}
} else if (!strcasecmp(v->name, "port")) {
- if (sscanf(v->value, "%d", &ourport) == 1) {
+ if (sscanf(v->value, "%30d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
} else {
ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
diff --git a/channels/chan_vpb.c b/channels/chan_vpb.c
index 0b067124b..6305034dc 100644
--- a/channels/chan_vpb.c
+++ b/channels/chan_vpb.c
@@ -2758,7 +2758,7 @@ static float parse_gain_value(char *gain_type, char *value)
float gain;
/* try to scan number */
- if (sscanf(value, "%f", &gain) != 1)
+ if (sscanf(value, "%30f", &gain) != 1)
{
ast_log(LOG_ERROR, "Invalid %s value '%s' in '%s' config\n", value, gain_type, config);
return DEFAULT_GAIN;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 8589de432..36b06529e 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -7666,7 +7666,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
char *stringp=NULL;
stringp=dest + 1;
s = strsep(&stringp, "/");
- if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+ if ((res = sscanf(s, "%30d%c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine group for data %s\n", (char *)data);
return NULL;
}
@@ -7701,7 +7701,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
channelmatch = x;
}
#ifdef ZAPATA_PRI
- else if ((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) > 1) {
+ else if ((res = sscanf(s, "%30d:%30d%c%30d", &trunkgroup, &crv, &opt, &y)) > 1) {
if ((trunkgroup < 1) || (crv < 1)) {
ast_log(LOG_WARNING, "Unable to determine trunk group and CRV for data %s\n", (char *)data);
return NULL;
@@ -7724,7 +7724,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
p = pris[x].crvs;
}
#endif
- else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+ else if ((res = sscanf(s, "%30d%c%30d", &x, &opt, &y)) < 1) {
ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data);
return NULL;
} else {
@@ -9797,7 +9797,7 @@ static int zap_show_channel(int fd, int argc, char **argv)
return RESULT_SHOWUSAGE;
#ifdef ZAPATA_PRI
if ((c = strchr(argv[3], ':'))) {
- if (sscanf(argv[3], "%d:%d", &trunkgroup, &channel) != 2)
+ if (sscanf(argv[3], "%30d:%30d", &trunkgroup, &channel) != 2)
return RESULT_SHOWUSAGE;
if ((trunkgroup < 1) || (channel < 1))
return RESULT_SHOWUSAGE;
@@ -10423,7 +10423,7 @@ static int setup_zap(int reload)
#ifdef ZAPATA_PRI
pri = NULL;
if (!strcasecmp(v->name, "crv")) {
- if (sscanf(c, "%d:%n", &trunkgroup, &y) != 1) {
+ if (sscanf(c, "%30d:%n", &trunkgroup, &y) != 1) {
ast_log(LOG_WARNING, "CRV must begin with trunkgroup followed by a colon at line %d\n", v->lineno);
ast_config_destroy(cfg);
ast_mutex_unlock(&iflock);
@@ -10452,9 +10452,9 @@ static int setup_zap(int reload)
#endif
chan = strsep(&c, ",");
while(chan) {
- if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
+ if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) {
/* Range */
- } else if (sscanf(chan, "%d", &start)) {
+ } else if (sscanf(chan, "%30d", &start)) {
/* Just one */
finish = start;
} else if (!strcasecmp(chan, "pseudo")) {
@@ -10511,13 +10511,13 @@ static int setup_zap(int reload)
ast_copy_string(drings.ringContext[2].contextData,v->value,sizeof(drings.ringContext[2].contextData));
} else if (!strcasecmp(v->name, "dring1")) {
ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
+ sscanf(ringc, "%30d,%30d,%30d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
} else if (!strcasecmp(v->name, "dring2")) {
ringc = v->value;
- sscanf(ringc,"%d,%d,%d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
+ sscanf(ringc,"%30d,%30d,%30d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
} else if (!strcasecmp(v->name, "dring3")) {
ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
+ sscanf(ringc, "%30d,%30d,%30d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
} else if (!strcasecmp(v->name, "usecallerid")) {
chan_conf.use_callerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "cidsignalling")) {
@@ -10560,7 +10560,7 @@ static int setup_zap(int reload)
} else if (!strcasecmp(v->name, "busycount")) {
chan_conf.busycount = atoi(v->value);
} else if (!strcasecmp(v->name, "busypattern")) {
- if (sscanf(v->value, "%d,%d", &chan_conf.busy_tonelength, &chan_conf.busy_quietlength) != 2) {
+ if (sscanf(v->value, "%30d,%30d", &chan_conf.busy_tonelength, &chan_conf.busy_quietlength) != 2) {
ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength\n");
}
} else if (!strcasecmp(v->name, "callprogress")) {
@@ -10592,7 +10592,7 @@ static int setup_zap(int reload)
chan_conf.echocancel=128;
}
} else if (!strcasecmp(v->name, "echotraining")) {
- if (sscanf(v->value, "%d", &y) == 1) {
+ if (sscanf(v->value, "%30d", &y) == 1) {
if ((y < 10) || (y > 4000)) {
ast_log(LOG_WARNING, "Echo training time must be within the range of 10 to 2000 ms at line %d\n", v->lineno);
} else {
@@ -10635,15 +10635,15 @@ static int setup_zap(int reload)
} else if (!strcasecmp(v->name, "transfertobusy")) {
chan_conf.transfertobusy = ast_true(v->value);
} else if (!strcasecmp(v->name, "rxgain")) {
- if (sscanf(v->value, "%f", &chan_conf.rxgain) != 1) {
+ if (sscanf(v->value, "%30f", &chan_conf.rxgain) != 1) {
ast_log(LOG_WARNING, "Invalid rxgain: %s\n", v->value);
}
} else if (!strcasecmp(v->name, "txgain")) {
- if (sscanf(v->value, "%f", &chan_conf.txgain) != 1) {
+ if (sscanf(v->value, "%30f", &chan_conf.txgain) != 1) {
ast_log(LOG_WARNING, "Invalid txgain: %s\n", v->value);
}
} else if (!strcasecmp(v->name, "tonezone")) {
- if (sscanf(v->value, "%d", &chan_conf.tonezone) != 1) {
+ if (sscanf(v->value, "%30d", &chan_conf.tonezone) != 1) {
ast_log(LOG_WARNING, "Invalid tonezone: %s\n", v->value);
}
} else if (!strcasecmp(v->name, "callerid")) {
@@ -10944,7 +10944,7 @@ static int setup_zap(int reload)
ast_copy_string(original_args, v->value, sizeof(original_args));
/* 16 cadences allowed (8 pairs) */
- element_count = sscanf(v->value, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
+ element_count = sscanf(v->value, "%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12], &c[13], &c[14], &c[15]);
/* Cadence must be even (on/off) */
if (element_count % 2 == 1) {
diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c
index b7ef989d3..c05aa0160 100644
--- a/channels/iax2-provision.c
+++ b/channels/iax2-provision.c
@@ -242,7 +242,7 @@ int iax_provision_version(unsigned int *version, const char *template, int force
ast_mutex_lock(&provlock);
ast_db_get("iax/provisioning/cache", template, tmp, sizeof(tmp));
- if (sscanf(tmp, "v%x", version) != 1) {
+ if (sscanf(tmp, "v%30x", version) != 1) {
if (strcmp(tmp, "u")) {
ret = iax_provision_build(&ied, version, template, force);
if (ret)
@@ -301,7 +301,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
v = ast_variable_browse(cfg, s);
while(v) {
if (!strcasecmp(v->name, "port") || !strcasecmp(v->name, "serverport")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < 65535)) {
+ if ((sscanf(v->value, "%5d", &x) == 1) && (x > 0) && (x < 65535)) {
if (!strcasecmp(v->name, "port")) {
cur->port = x;
foundportno = 1;
@@ -327,7 +327,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
} else
ast_log(LOG_WARNING, "Ignoring invalid codec '%s' for '%s' at line %d\n", v->value, s, v->lineno);
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &x) == 1)
+ if (sscanf(v->value, "%3d", &x) == 1)
cur->tos = x & 0xff;
else if (!strcasecmp(v->value, "lowdelay"))
cur->tos = IPTOS_LOWDELAY;
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index b2c4289fd..5324af63f 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -556,9 +556,9 @@ static int _parse (union misdn_cfg_pt *dest, char *value, enum misdn_cfg_type ty
{
char *pat;
if (strchr(value,'x'))
- pat="%x";
+ pat="%30x";
else
- pat="%d";
+ pat="%30d";
if (sscanf(value, pat, &tmp)) {
dest->num = (int *)malloc(sizeof(int));
memcpy(dest->num, &tmp, sizeof(int));
@@ -572,7 +572,7 @@ static int _parse (union misdn_cfg_pt *dest, char *value, enum misdn_cfg_type ty
break;
case MISDN_CTYPE_BOOLINT:
dest->num = (int *)malloc(sizeof(int));
- if (sscanf(value, "%d", &tmp)) {
+ if (sscanf(value, "%30d", &tmp)) {
memcpy(dest->num, &tmp, sizeof(int));
} else {
*(dest->num) = (ast_true(value) ? boolint_def : 0);
@@ -639,7 +639,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
for (token = strsep(&v->value, ","); token; token = strsep(&v->value, ","), *ptpbuf = 0) {
if (!*token)
continue;
- if (sscanf(token, "%d-%d%s", &start, &end, ptpbuf) >= 2) {
+ if (sscanf(token, "%30d-%30d%511s", &start, &end, ptpbuf) >= 2) {
for (; start <= end; start++) {
if (start <= max_ports && start > 0) {
cfg_for_ports[start] = 1;
@@ -648,7 +648,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
CLI_ERROR(v->name, v->value, cat);
}
} else {
- if (sscanf(token, "%d%s", &start, ptpbuf)) {
+ if (sscanf(token, "%30d%511s", &start, ptpbuf)) {
if (start <= max_ports && start > 0) {
cfg_for_ports[start] = 1;
ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0;