Fix a possible crash due to passing NULL to ast_variables_dup()
authorMark Michelson <mmichelson@digium.com>
Wed, 1 Aug 2012 19:37:03 +0000 (19:37 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 1 Aug 2012 19:37:03 +0000 (19:37 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370726 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index f7fa7b5..97e92fc 100644 (file)
@@ -2556,7 +2556,9 @@ static int authenticate(struct mansession *s, const struct message *m)
        s->session->readperm = user->readperm;
        s->session->writeperm = user->writeperm;
        s->session->writetimeout = user->writetimeout;
-       s->session->chanvars = ast_variables_dup(user->chanvars);
+       if (user->chanvars) {
+               s->session->chanvars = ast_variables_dup(user->chanvars);
+       }
 
        filter_iter = ao2_iterator_init(user->whitefilters, 0);
        while ((regex_filter = ao2_iterator_next(&filter_iter))) {