Check sip.conf maxforwards parameter for range 1 <= x <= 255.
authorRichard Mudgett <rmudgett@digium.com>
Fri, 11 Nov 2011 18:37:32 +0000 (18:37 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 11 Nov 2011 18:37:32 +0000 (18:37 +0000)
JIRA AST-710
........

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344717 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 94f9579..5896e6e 100644 (file)
@@ -27939,7 +27939,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                                        peer->amaflags = format;
                                }
                        } else if (!strcasecmp(v->name, "maxforwards")) {
-                               if ((sscanf(v->value, "%30d", &peer->maxforwards) != 1) || (peer->maxforwards < 1)) {
+                               if (sscanf(v->value, "%30d", &peer->maxforwards) != 1
+                                       || peer->maxforwards < 1 || 255 < peer->maxforwards) {
                                        ast_log(LOG_WARNING, "'%s' is not a valid maxforwards value at line %d.  Using default.\n", v->value, v->lineno);
                                        peer->maxforwards = sip_cfg.default_max_forwards;
                                }