[svn-commits] tilghman: trunk r212627 - /trunk/apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 17 14:57:46 CDT 2009


Author: tilghman
Date: Mon Aug 17 14:57:42 2009
New Revision: 212627

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=212627
Log:
Check the return value of opendir(3), or we may crash.
(closes issue #15720)
 Reported by: tobias_e

Modified:
    trunk/apps/app_voicemail.c

Modified: trunk/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=212627&r1=212626&r2=212627
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Mon Aug 17 14:57:42 2009
@@ -3576,7 +3576,10 @@
 	 * doing a stat repeatedly on a predicted sequence.  I suspect this
 	 * is partially due to stat(2) internally doing a readdir(2) itself to
 	 * find each file. */
-	msgdir = opendir(dir);
+	if (!(msgdir = opendir(dir))) {
+		return -1;
+	}
+
 	while ((msgdirent = readdir(msgdir))) {
 		if (sscanf(msgdirent->d_name, "msg%30d", &msgdirint) == 1 && msgdirint < MAXMSGLIMIT)
 			map[msgdirint] = 1;




More information about the svn-commits mailing list