diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-17 20:00:06 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-17 20:00:06 +0000 |
commit | e2288c03e8fae586cd3259fc168069d97f921b42 (patch) | |
tree | 07e9fa17d4dd628575d1840808459bd9caf98638 /apps | |
parent | 34d6e4fa69ee0358d0927661121b0a453b29df3d (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.1@212630 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index b34899bd7..b72d0ddf0 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3447,7 +3447,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; |