diff options
author | rmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-24 21:18:48 +0000 |
---|---|---|
committer | rmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-24 21:18:48 +0000 |
commit | 1447facb2a123c59f3fd85526e64a1e5cb08bac3 (patch) | |
tree | ba9b5a012a595e90aebb29b490bd18a9a0f5c585 /channels/chan_dahdi.c | |
parent | a32e476299a3fe873f0c759a58dd35adb725001f (diff) |
Merged revisions 203037 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r203037 | rmudgett | 2009-06-24 16:08:55 -0500 (Wed, 24 Jun 2009) | 15 lines
Merged revisions 203036 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r203036 | rmudgett | 2009-06-24 16:01:43 -0500 (Wed, 24 Jun 2009) | 8 lines
Improved chan_dahdi.conf pritimer error checking.
Valid format is: pritimer=timer_name,timer_value
* Fixed segfault if the ',' is missing.
* Completely check the range returned by pri_timer2idx() to prevent
possible access outside array bounds.
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@203044 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r-- | channels/chan_dahdi.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index e4d93fdc9..879dba6b5 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -14495,22 +14495,34 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v, #endif } else if (!strcasecmp(v->name, "pritimer")) { #ifdef PRI_GETSET_TIMERS - char tmp[20], *timerc, *c = tmp; - int timer, timeridx; + char tmp[20]; + char *timerc; + char *c; + int timer; + int timeridx; + ast_copy_string(tmp, v->value, sizeof(tmp)); + c = tmp; timerc = strsep(&c, ","); - if (timerc) { + if (!ast_strlen_zero(timerc) && !ast_strlen_zero(c)) { + timeridx = pri_timer2idx(timerc); timer = atoi(c); - if (!timer) - ast_log(LOG_WARNING, "'%s' is not a valid value for an ISDN timer at line %d.\n", timerc, v->lineno); - else { - if ((timeridx = pri_timer2idx(timerc)) >= 0) - pritimers[timeridx] = timer; - else - ast_log(LOG_WARNING, "'%s' is not a valid ISDN timer at line %d.\n", timerc, v->lineno); + if (timeridx < 0 || PRI_MAX_TIMERS <= timeridx) { + ast_log(LOG_WARNING, + "'%s' is not a valid ISDN timer at line %d.\n", timerc, + v->lineno); + } else if (!timer) { + ast_log(LOG_WARNING, + "'%s' is not a valid value for ISDN timer '%s' at line %d.\n", + c, timerc, v->lineno); + } else { + pritimers[timeridx] = timer; } - } else - ast_log(LOG_WARNING, "'%s' is not a valid ISDN timer configuration string at line %d.\n", v->value, v->lineno); + } else { + ast_log(LOG_WARNING, + "'%s' is not a valid ISDN timer configuration string at line %d.\n", + v->value, v->lineno); + } } else if (!strcasecmp(v->name, "facilityenable")) { confp->pri.facilityenable = ast_true(v->value); |