diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-17 19:58:52 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-17 19:58:52 +0000 |
commit | 3e1a3a051ec3b1cd391e47e3b39a61769707fd40 (patch) | |
tree | fa937801a3984dd6f3cc52bd6d366fb890c94c1a /apps | |
parent | 1505284fd8ed6005689e84f1ed500c7465e541b2 (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.0@212628 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 3f7f1c220..c72f5311b 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3031,7 +3031,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; |