Fix for uninitialized workspace in ast_cdr_getvar, pointed out by sergee
authorJoshua Colp <jcolp@digium.com>
Mon, 14 Aug 2006 18:07:21 +0000 (18:07 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 14 Aug 2006 18:07:21 +0000 (18:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@39731 65c4cc65-6c06-0410-ace0-fbb531ad65f3

cdr.c

diff --git a/cdr.c b/cdr.c
index 8a68050..22f7999 100644 (file)
--- a/cdr.c
+++ b/cdr.c
@@ -267,6 +267,8 @@ void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *wor
                ast_copy_string(workspace, cdr->userfield, workspacelen);
        else if ((varbuf = ast_cdr_getvar_internal(cdr, name, recur)))
                ast_copy_string(workspace, varbuf, workspacelen);
                ast_copy_string(workspace, cdr->userfield, workspacelen);
        else if ((varbuf = ast_cdr_getvar_internal(cdr, name, recur)))
                ast_copy_string(workspace, varbuf, workspacelen);
+       else
+               workspace[0] = '\0';
 
        if (!ast_strlen_zero(workspace))
                *ret = workspace;
 
        if (!ast_strlen_zero(workspace))
                *ret = workspace;