stas Thu Mar 8 22:57:02 2007 UTC
Modified files:
/php-src/ext/mysqli mysqli_api.c
Log:
MFB: fix crash/leak in bug #38710
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.144&r2=1.145&diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.144
php-src/ext/mysqli/mysqli_api.c:1.145
--- php-src/ext/mysqli/mysqli_api.c:1.144 Sat Feb 24 16:25:54 2007
+++ php-src/ext/mysqli/mysqli_api.c Thu Mar 8 22:57:02 2007
@@ -15,7 +15,7 @@
| Author: Georg Richter <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
- $Id: mysqli_api.c,v 1.144 2007/02/24 16:25:54 helly Exp $
+ $Id: mysqli_api.c,v 1.145 2007/03/08 22:57:02 stas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -764,7 +764,16 @@
}
#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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php