diff options
-rw-r--r-- | apps/app_voicemail.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 50acc066d..f44ecc49b 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1419,7 +1419,12 @@ static int imap_store_file(char *dir, char *mailboxuser, char *mailboxcontext, i *(vmu->email) = '\0'; return -1; } - fread(buf, len, 1, p); + if (fread(buf, len, 1, p) < len) { + if (ferror(p)) { + ast_log(LOG_ERROR, 'Short read while reading in mail file.\n"); + return -1; + } + } ((char *)buf)[len] = '\0'; INIT(&str, mail_string, buf, len); init_mailstream(vms, NEW_FOLDER); @@ -1840,7 +1845,11 @@ static void write_file(char *filename, char *buffer, unsigned long len) FILE *output; output = fopen (filename, "w"); - fwrite (buffer, len, 1, output); + if (fwrite(buffer, len, 1, output) < len) { + if (ferror(output)) { + ast_log(LOG_ERROR, "Short write while writing e-mail body.\n"); + } + } fclose (output); } |