]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 47862 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 20 Nov 2006 20:00:54 +0000 (20:00 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 20 Nov 2006 20:00:54 +0000 (20:00 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r47862 | tilghman | 2006-11-20 13:59:07 -0600 (Mon, 20 Nov 2006) | 2 lines

Failing to trap -1 error from mmap causes segfault (Issue 8385)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47863 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index df220c9c5b2f4c8bb1f279d0d7eccb046fbf0211..df302170c327a807672deb3002b2e6d9b6e771fe 100644 (file)
@@ -1098,8 +1098,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);