mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed possible crash.
This commit is contained in:
parent
cf33729c20
commit
b7784d96b0
1 changed files with 8 additions and 0 deletions
|
@ -110,6 +110,10 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
|
||||||
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
|
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
|
||||||
struct pdo_column_data *cols = stmt->columns;
|
struct pdo_column_data *cols = stmt->columns;
|
||||||
|
|
||||||
|
if (!S->result) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
cols[colno].name = estrdup(PQfname(S->result, colno));
|
cols[colno].name = estrdup(PQfname(S->result, colno));
|
||||||
cols[colno].namelen = strlen(cols[colno].name);
|
cols[colno].namelen = strlen(cols[colno].name);
|
||||||
cols[colno].maxlen = PQfsize(S->result, colno);
|
cols[colno].maxlen = PQfsize(S->result, colno);
|
||||||
|
@ -123,6 +127,10 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned
|
||||||
{
|
{
|
||||||
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
|
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
|
||||||
|
|
||||||
|
if (!S->result) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* We have already increased count by 1 in pgsql_stmt_fetch() */
|
/* We have already increased count by 1 in pgsql_stmt_fetch() */
|
||||||
*ptr = PQgetvalue(S->result, S->current_row - 1, colno);
|
*ptr = PQgetvalue(S->result, S->current_row - 1, colno);
|
||||||
*len = PQgetlength(S->result, S->current_row - 1, colno);
|
*len = PQgetlength(S->result, S->current_row - 1, colno);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue