summaryrefslogtreecommitdiff
path: root/ext/pdo
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2007-09-12 21:21:18 +0000
committerStanislav Malyshev <stas@php.net>2007-09-12 21:21:18 +0000
commit1f45d49a0c45c631a9e76ec20fcff492fa78f59b (patch)
treec31936a321b11db9df7d3b8cb44778aa7d20290d /ext/pdo
parent910850be511805f42cdf89725a14ffcaa13f7804 (diff)
downloadphp-git-1f45d49a0c45c631a9e76ec20fcff492fa78f59b.tar.gz
fix crash if stream is empty and reader function sets buffer as null
Diffstat (limited to 'ext/pdo')
-rwxr-xr-xext/pdo/pdo_stmt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index ca9120550b..ef86c7e1ac 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -569,7 +569,11 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
char *buf = NULL;
size_t len;
len = php_stream_copy_to_mem((php_stream*)value, &buf, PHP_STREAM_COPY_ALL, 0);
- ZVAL_STRINGL(dest, buf, len, 0);
+ if(buf == NULL) {
+ ZVAL_EMPTY_STRING(dest);
+ } else {
+ ZVAL_STRINGL(dest, buf, len, 0);
+ }
php_stream_close((php_stream*)value);
} else {
php_stream_to_zval((php_stream*)value, dest);