fix seg fault if no variable is specified (bug #4907)
authorRussell Bryant <russell@russellbryant.com>
Fri, 5 Aug 2005 15:19:51 +0000 (15:19 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 5 Aug 2005 15:19:51 +0000 (15:19 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6289 65c4cc65-6c06-0410-ace0-fbb531ad65f3

manager.c

index a5044eb..fbe8c83 100755 (executable)
--- a/manager.c
+++ b/manager.c
@@ -292,7 +292,11 @@ struct ast_variable *astman_get_variables(struct message *m)
        for (x = 0; x < m->hdrcount; x++) {
                if (!strncasecmp("Variable: ", m->headers[x], varlen)) {
                        var = val = ast_strdupa(m->headers[x] + varlen);
        for (x = 0; x < m->hdrcount; x++) {
                if (!strncasecmp("Variable: ", m->headers[x], varlen)) {
                        var = val = ast_strdupa(m->headers[x] + varlen);
+                       if (!var)
+                               return head;                            
                        strsep(&val, "=");
                        strsep(&val, "=");
+                       if (!val || ast_strlen_zero(var))
+                               continue;
                        cur = ast_variable_new(var, val);
                        if (head) {
                                cur->next = head;
                        cur = ast_variable_new(var, val);
                        if (head) {
                                cur->next = head;