chan_sip: [general] maxforwards, not checked for a value greater than 255
[asterisk/asterisk.git] / 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;
                        }