aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-05 02:52:37 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-05 02:52:37 +0000
commit6d40ed29cb779c8df890ed9059998c0a66f42055 (patch)
tree8fe912617532c8e0748ddf48a9faa0ceda6d9e2e /apps
parentdbe497ccd80f3b742dc03ea8bd4ed8c12250a8ff (diff)
Merged revisions 161147 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r161147 | seanbright | 2008-12-04 21:47:54 -0500 (Thu, 04 Dec 2008) | 3 lines Check the return value of fread/fwrite so the compiler doesn't complain. Only a problem when IMAP_STORAGE is enabled. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@161149 f38db490-d61c-443f-a65b-d21fe96a405b
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 acf841868..7e9779994 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1785,7 +1785,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);
@@ -2132,7 +2137,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);
}