From: Alec L Davis Date: Thu, 26 Apr 2012 09:46:38 +0000 (+0000) Subject: chan_sip: [general] maxforwards, not checked for a value greater than 255 X-Git-Tag: 10.5.0-rc1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=194b818d8fceabd8f2b7ccf02933f7bf60d62593;p=thirdparty%2Fasterisk.git 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@363935 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a5a59773e2..46fc831faf 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -29568,7 +29568,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; }