summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
-rw-r--r--ext/mysqli/mysqli_api.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index f69f6e7634..7d367e670c 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -395,7 +395,9 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc,
different lengths and you will see that we get different lengths in stmt->stmt->fields[ofs].length
The just take 256 and saves us from realloc-ing.
*/
- stmt->result.buf[ofs].buflen = 256;
+ stmt->result.buf[ofs].buflen =
+ (stmt->stmt->fields) ? (stmt->stmt->fields[ofs].length) ? stmt->stmt->fields[ofs].length + 1: 256: 256;
+
} else {
/*
the user has called store_result(). if he does not there is no way to determine the