Skip to content

Commit

Permalink
Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO).
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilia Alshanetsky committed Mar 14, 2012
1 parent 8665e02 commit 601d17d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ PHP NEWS
. Fixed bug #61194 (PDO should export compression flag with myslqnd).
(Johannes)

- PDO_odbc
. Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO). (Ilia)

- PDO_pgsql
. Fixed bug #61267 (pdo_pgsql's PDO::exec() returns the number of SELECTed
rows on postgresql >= 9). (ben dot pineau at gmail dot com)
Expand Down
12 changes: 7 additions & 5 deletions ext/pdo_odbc/odbc_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,14 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l

if (C->fetched_len != SQL_NO_TOTAL) {
/* use size suggested by the driver, if it knows it */
alloced = C->fetched_len + 1;
buf = emalloc(C->fetched_len + 1);
memcpy(buf, C->data, C->fetched_len);
buf[C->fetched_len] = 0;
used = C->fetched_len;
} else {
buf = estrndup(C->data, 256);
used = 255; /* not 256; the driver NUL terminated the buffer */
}

buf = emalloc(alloced);
memcpy(buf, C->data, 256);
used = 255; /* not 256; the driver NUL terminated the buffer */

do {
C->fetched_len = 0;
Expand Down

0 comments on commit 601d17d

Please sign in to comment.