diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-05-19 20:34:01 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-05-19 20:34:01 +0000 |
commit | 56abe4de4ab0813509a022f42c0ddedeaddeaea3 (patch) | |
tree | 65ad621b6e86cbfcfc1b1cba7a90bd249efeb254 /ext/pdo_mysql/mysql_statement.c | |
parent | 38a409c02fa856f53b5ccc2408e6753ba0e3e779 (diff) | |
download | php-git-56abe4de4ab0813509a022f42c0ddedeaddeaea3.tar.gz |
Prevent possible crash when working with column containing NULL.
Diffstat (limited to 'ext/pdo_mysql/mysql_statement.c')
-rwxr-xr-x | ext/pdo_mysql/mysql_statement.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 6f8d70a06a..f8e1b3d097 100755 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -139,7 +139,9 @@ static int mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned pdo_mysql_error(S->H); return 0; } - *ptr = estrndup(S->current_data[colno], S->current_lengths[colno] +1); + if (S->current_data[colno]) { + *ptr = estrndup(S->current_data[colno], S->current_lengths[colno] +1); + } *len = S->current_lengths[colno]; return 1; } |