]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Ensure 'qualifygap' isn't negative
authorSean Bright <sean.bright@gmail.com>
Mon, 25 Mar 2019 19:31:23 +0000 (15:31 -0400)
committerSean Bright <sean.bright@gmail.com>
Mon, 25 Mar 2019 19:31:26 +0000 (15:31 -0400)
Passing negative intervals to the scheduler rips a hole in the
space-time continuum.

ASTERISK-25792 #close
Reported by: Paul Sandys

Change-Id: Ie706f21cee05f76ffb6f7d89e9c867930ee7bcd7

channels/chan_sip.c

index ac922fa8b5e589f995c89297c408f0fa6458a1f9..ce88e525571f4bf5cd0914f3a681cc595306bc12 100644 (file)
@@ -32900,7 +32900,8 @@ static int reload_config(enum channelreloadreason reason)
                                ast_log(LOG_WARNING, "Usage of SIP_CAUSE is deprecated.  Please use HANGUPCAUSE instead.\n");
                        }
                } else if (!strcasecmp(v->name, "qualifygap")) {
-                       if (sscanf(v->value, "%30d", &global_qualify_gap) != 1) {
+                       if (sscanf(v->value, "%30d", &global_qualify_gap) != 1
+                               || global_qualify_gap < 0) {
                                ast_log(LOG_WARNING, "Invalid qualifygap '%s' at line %d of %s\n", v->value, v->lineno, config);
                                global_qualify_gap = DEFAULT_QUALIFY_GAP;
                        }