aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-17 20:01:00 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-17 20:01:00 +0000
commit7e805dd1a85f691e19f0f062a0f1db4bf192c026 (patch)
tree1b9d7c262c3d9611222f77ff183925ee598f09bf /apps
parentfc9e23a46d58c6347513315f2e9378437326bc43 (diff)
Merged revisions 212627 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r212627 | tilghman | 2009-08-17 14:57:42 -0500 (Mon, 17 Aug 2009) | 4 lines Check the return value of opendir(3), or we may crash. (closes issue #15720) Reported by: tobias_e ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@212631 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 44c4eb266..e82a2e63b 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3573,7 +3573,10 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
* 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;