aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-16 21:33:57 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-16 21:33:57 +0000
commit050c4cc053c192358b105a9f070c7f1399da45c9 (patch)
tree81def31eedcd0dc73a9636de3253416642cc79ae /apps/app_voicemail.c
parent311162d83ac16f73b7d8e289551233603a5580c6 (diff)
Merged revisions 51159 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r51159 | tilghman | 2007-01-16 15:28:39 -0600 (Tue, 16 Jan 2007) | 10 lines Merged revisions 51158 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r51158 | tilghman | 2007-01-16 15:26:06 -0600 (Tue, 16 Jan 2007) | 2 lines Postgres driver doesn't like a NULL pointer when retrieving the length (Bug 8513) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51160 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 6cb47e745..f966fbce6 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1078,7 +1078,7 @@ static int retrieve_file(char *dir, int msgnum)
}
if (!strcasecmp(coltitle, "recording")) {
off_t offset;
- res = SQLGetData(stmt, x + 1, SQL_BINARY, NULL, 0, &colsize2);
+ res = SQLGetData(stmt, x + 1, SQL_BINARY, rowdata, 0, &colsize2);
fdlen = colsize2;
if (fd > -1) {
char tmp[1]="";
@@ -1090,15 +1090,14 @@ static int retrieve_file(char *dir, int msgnum)
}
/* Read out in small chunks */
for (offset = 0; offset < colsize2; offset += CHUNKSIZE) {
- /* +1 because SQLGetData likes null-terminating binary data */
- if ((fdm = mmap(NULL, CHUNKSIZE + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
+ if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
goto yuck;
} else {
- res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE + 1, NULL);
- munmap(fdm, 0);
+ res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE, NULL);
+ munmap(fdm, CHUNKSIZE);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
unlink(full_fn);