aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-20 19:59:07 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-20 19:59:07 +0000
commitcff70272fffbf19579aa8a12312fa862e09d8a64 (patch)
treea321abbd20f02aa6bb3314414df1803d40ab238d /apps/app_voicemail.c
parenta98a177d9e0e2333c1b549b198c4908262d530f4 (diff)
Failing to trap -1 error from mmap causes segfault (Issue 8385)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@47862 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 34f8303eb..e76669db7 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -935,8 +935,13 @@ static int retrieve_file(char *dir, int msgnum)
fd = -1;
continue;
}
- if (fd > -1)
- fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (fd > -1) {
+ if ((fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == -1) {
+ ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ goto yuck;
+ }
+ }
}
if (fdm) {
memset(fdm, 0, fdlen);