chan_sip: [general] maxforwards, not checked for a value greater than 255

The peer maxforwards is checked for both '< 1' and '> 255',
but the default 'maxforwards' in the [general] section is only checked for '< 1'

alecdavis (license 585)
Reported by: alecdavis
Tested by: alecdavis
 
Review: https://reviewboard.asterisk.org/r/1888/
........

Merged revisions 363934 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 363935 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Alec L Davis
2012-04-26 09:48:55 +00:00
parent 9d655bd0e8
commit 5746e0d2ac

View File

@@ -29819,7 +29819,8 @@ static int reload_config(enum channelreloadreason reason)
} else if (!strcasecmp(v->name, "use_q850_reason")) {
ast_set2_flag(&global_flags[1], ast_true(v->value), SIP_PAGE2_Q850_REASON);
} else if (!strcasecmp(v->name, "maxforwards")) {
if ((sscanf(v->value, "%30d", &sip_cfg.default_max_forwards) != 1) || (sip_cfg.default_max_forwards < 1)) {
if (sscanf(v->value, "%30d", &sip_cfg.default_max_forwards) != 1
|| sip_cfg.default_max_forwards < 1 || 255 < sip_cfg.default_max_forwards) {
ast_log(LOG_WARNING, "'%s' is not a valid maxforwards value at line %d. Using default.\n", v->value, v->lineno);
sip_cfg.default_max_forwards = DEFAULT_MAX_FORWARDS;
}