chan_sip: [general] maxforwards, not checked for a value greater than 255
authorAlec L Davis <sivad.a@paradise.net.nz>
Thu, 26 Apr 2012 09:48:55 +0000 (09:48 +0000)
committerAlec L Davis <sivad.a@paradise.net.nz>
Thu, 26 Apr 2012 09:48:55 +0000 (09:48 +0000)
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

channels/chan_sip.c

index 2acb2b3..1f987e7 100644 (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;
                        }