mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 06:26:41 +00:00
Fix infinite loop scenario and add some sanity checking to prevent segfault on a NULL parameter coming in (which probably shouldn't happen, but just to be safe...)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@30770 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -622,6 +622,9 @@ static int add_to_interfaces(char *interface)
|
|||||||
{
|
{
|
||||||
struct ast_member_interfaces *curint, *newint;
|
struct ast_member_interfaces *curint, *newint;
|
||||||
|
|
||||||
|
if (!interface)
|
||||||
|
return 0;
|
||||||
|
|
||||||
AST_LIST_LOCK(&interfaces);
|
AST_LIST_LOCK(&interfaces);
|
||||||
AST_LIST_TRAVERSE(&interfaces, curint, list) {
|
AST_LIST_TRAVERSE(&interfaces, curint, list) {
|
||||||
if (!strcasecmp(curint->interface, interface))
|
if (!strcasecmp(curint->interface, interface))
|
||||||
@@ -649,6 +652,9 @@ static int interface_exists_global(char *interface)
|
|||||||
struct member *mem;
|
struct member *mem;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!interface)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ast_mutex_lock(&qlock);
|
ast_mutex_lock(&qlock);
|
||||||
for (q = queues; q && !ret; q = q->next) {
|
for (q = queues; q && !ret; q = q->next) {
|
||||||
ast_mutex_lock(&q->lock);
|
ast_mutex_lock(&q->lock);
|
||||||
@@ -658,6 +664,7 @@ static int interface_exists_global(char *interface)
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
mem = mem->next;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
}
|
}
|
||||||
@@ -671,6 +678,9 @@ static int remove_from_interfaces(char *interface)
|
|||||||
{
|
{
|
||||||
struct ast_member_interfaces *curint;
|
struct ast_member_interfaces *curint;
|
||||||
|
|
||||||
|
if (!interface)
|
||||||
|
return 0;
|
||||||
|
|
||||||
AST_LIST_LOCK(&interfaces);
|
AST_LIST_LOCK(&interfaces);
|
||||||
AST_LIST_TRAVERSE_SAFE_BEGIN(&interfaces, curint, list) {
|
AST_LIST_TRAVERSE_SAFE_BEGIN(&interfaces, curint, list) {
|
||||||
if (!strcasecmp(curint->interface, interface) && !interface_exists_global(interface)) {
|
if (!strcasecmp(curint->interface, interface) && !interface_exists_global(interface)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user