diff options
| author | Stanislav Malyshev <stas@php.net> | 2007-03-08 22:57:02 +0000 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2007-03-08 22:57:02 +0000 |
| commit | 031991d7a7b4899ed7e440a939487ce0117aa821 (patch) | |
| tree | eca2bd7da44512f00d5c9d5110f8d52189063f2d /ext/mysqli/mysqli_api.c | |
| parent | d3b90533fc91ab4ffbb92c8d4e6afa5e735bea76 (diff) | |
| download | php-git-031991d7a7b4899ed7e440a939487ce0117aa821.tar.gz | |
MFB: 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 41ccff187b..77af19f856 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -764,7 +764,16 @@ PHP_FUNCTION(mysqli_stmt_fetch) } #endif else { - ZVAL_UTF8_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, stmt->result.buf[i].buflen, ZSTR_DUPLICATE); +#if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002 + if(ret == MYSQL_DATA_TRUNCATED && *(stmt->stmt->bind[i].error) != 0) { + /* result was truncated */ + ZVAL_UTF8_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, stmt->stmt->bind[i].buffer_length, ZSTR_DUPLICATE); + } else { +#else + { +#endif + ZVAL_UTF8_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, stmt->result.buf[i].buflen, ZSTR_DUPLICATE); + } } break; |
