diff options
| author | Stanislav Malyshev <stas@php.net> | 2007-03-08 22:49:53 +0000 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2007-03-08 22:49:53 +0000 |
| commit | 6e460bab4ed894d1aa8b2d977ae3853b858e0f19 (patch) | |
| tree | ac2bb53fbab30b018b39a2f4a084704051b50051 /ext/mysqli/mysqli_api.c | |
| parent | c4423ae27d4e0972c20060ec259daedc2da5d32c (diff) | |
| download | php-git-6e460bab4ed894d1aa8b2d977ae3853b858e0f19.tar.gz | |
fix crash/leak in bug #38710
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
| -rw-r--r-- | ext/mysqli/mysqli_api.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 69c944894f..71a7308f6a 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -723,7 +723,16 @@ PHP_FUNCTION(mysqli_stmt_fetch) } #endif else { - ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, stmt->result.buf[i].buflen, 1); +#if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002 + if(ret == MYSQL_DATA_TRUNCATED && *(stmt->stmt->bind[i].error) != 0) { + /* result was truncated */ + ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, stmt->stmt->bind[i].buffer_length, 1); + } else { +#else + { +#endif + ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, stmt->result.buf[i].buflen, 1); + } } break; default: |
