]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Initialize buffers in getvar and getvarfull.
authorRussell Bryant <russell@russellbryant.com>
Fri, 22 Apr 2011 13:58:03 +0000 (13:58 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 22 Apr 2011 13:58:03 +0000 (13:58 +0000)
Initialize the buffers used to hold the result from GET VARIABLE or
GET VARIABLE FULL.  The bug report shows func_read returning garbage in
the result.  It assumed that the buffer passed in was initialized, like many
other functions do.  In the more common code path (through the dialplan), it
is initialized, so just initialize it here too.

(closes issue #19050)
Reported by: johnz

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@314778 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_agi.c

index 7fd2aa006216c71ca150066af02b1b8326864521..6fb78576e4f9cb4ed7c3a5b811d8038e904b9cbc 100644 (file)
@@ -1821,7 +1821,7 @@ static int handle_setvariable(struct ast_channel *chan, AGI *agi, int argc, char
 static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char **argv)
 {
        char *ret;
-       char tempstr[1024];
+       char tempstr[1024] = "";
 
        if (argc != 3)
                return RESULT_SHOWUSAGE;
@@ -1843,7 +1843,7 @@ static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char
 
 static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc, char **argv)
 {
-       char tmp[4096];
+       char tmp[4096] = "";
        struct ast_channel *chan2=NULL;
 
        if ((argc != 4) && (argc != 5))