]> granicus.if.org Git - php/commitdiff
fixed bug in mysql_real_escape_string:
authorGeorg Richter <georg@php.net>
Sun, 21 Jul 2002 20:16:03 +0000 (20:16 +0000)
committerGeorg Richter <georg@php.net>
Sun, 21 Jul 2002 20:16:03 +0000 (20:16 +0000)
allocated 1 more byte for '\0' terminating character

ext/mysql/php_mysql.c

index a9c789fa53035b6d5d1bcc5ecbe3eb00fce6165c..cf81a63cf3ce8a7f1491535a90e9061b836df529 100644 (file)
@@ -1625,7 +1625,7 @@ PHP_FUNCTION(mysql_real_escape_string)
 
        new_str = emalloc(str_len * 2 + 1);
        new_str_len = mysql_real_escape_string(&mysql->conn, new_str, str, str_len);
-       new_str = erealloc(new_str, new_str_len);
+       new_str = erealloc(new_str, new_str_len + 1);
 
        RETURN_STRINGL(new_str, new_str_len, 0);
 }