php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #74544
Patch bug74544.diff revision 2017-07-24 10:11 UTC by johannes at schlueters dot de

Patch bug74544.diff for MySQLi related Bug #74544

Patch version 2017-07-24 10:11 UTC

Return to Bug #74544 | Download this patch
Patch Revisions:

Developer: johannes@schlueters.de

diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 03a39d7..7b88731 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1965,7 +1965,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
 	}
 	MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
 
-	newstr = zend_string_alloc(2 * escapestr_len, 0);
+	newstr = zend_string_safe_alloc(2, escapestr_len, 0, 0);
 	ZSTR_LEN(newstr) = mysql_real_escape_string(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len);
 	newstr = zend_string_truncate(newstr, ZSTR_LEN(newstr), 0);
 
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Feb 25 07:01:26 2020 UTC