summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSean Bright <sean@malleable.com>2008-12-05 02:47:54 +0000
committerSean Bright <sean@malleable.com>2008-12-05 02:47:54 +0000
commit2afd7a09a76d5d62a4efbcb03fa8bd35c8ce5ed1 (patch)
tree431c697595f5bc2244eb6ca1ebe6ba6342428ef8 /apps
parentf9b650779690f8adaa6370de05710d1daa5ca1ad (diff)
Check the return value of fread/fwrite so the compiler doesn't complain. Only a
problem when IMAP_STORAGE is enabled. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 65a17c0d8..ba8a7ab69 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1784,7 +1784,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);
ret = init_mailstream(vms, NEW_FOLDER);
@@ -2131,7 +2136,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);
}