[asterisk-commits] seanbright: branch 1.6.0 r161148 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 4 20:51:49 CST 2008


Author: seanbright
Date: Thu Dec  4 20:51:48 2008
New Revision: 161148

URL: http://svn.digium.com/view/asterisk?view=rev&rev=161148
Log:
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.
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=161148&r1=161147&r2=161148
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Thu Dec  4 20:51:48 2008
@@ -1419,7 +1419,12 @@
 			*(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 @@
 	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);
 }
 




More information about the asterisk-commits mailing list