]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Initialize some memory to fix crashes when leaving voicemail. This problem
authorRussell Bryant <russell@russellbryant.com>
Mon, 17 Sep 2007 20:00:32 +0000 (20:00 +0000)
committerRussell Bryant <russell@russellbryant.com>
Mon, 17 Sep 2007 20:00:32 +0000 (20:00 +0000)
was fixed by running Asterisk under valgrind.
(closes issue #10746, reported by arcivanov, patched by me)

*** IMPORTANT NOTE:  We need to check to see if this same bug exists elsewhere.

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

apps/app_voicemail.c

index 4c41ce445c32a219f3a5631bb3b111ee2c815406..d3d29e60651cb46a5d0c7926582d06daeb7cc9bc 100644 (file)
@@ -1783,6 +1783,8 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
 #define ENDL "\n"
 #endif
 
+       memset(&tm, 0, sizeof(tm));
+
        gethostname(host, sizeof(host) - 1);
        if (strchr(srcemail, '@'))
                ast_copy_string(who, srcemail, sizeof(who));
@@ -2049,8 +2051,12 @@ static int get_date(char *s, int len)
 {
        struct tm tm;
        time_t t;
-       t = time(0);
+
+       time(&t);
+       memset(&tm, 0, sizeof(tm));
+
        ast_localtime(&t, &tm, NULL);
+
        return strftime(s, len, "%a %b %e %r %Z %Y", &tm);
 }