derick Tue Jul 5 08:45:39 2005 EDT
Modified files:
/php-src NEWS
/php-src/ext/pgsql pgsql.c
Log:
- Fixed memory corruption in pg_copy_from() in case the as_null parameter was
passed. (Derick)
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1979&r2=1.1980&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1979 php-src/NEWS:1.1980
--- php-src/NEWS:1.1979 Mon Jul 4 08:47:09 2005
+++ php-src/NEWS Tue Jul 5 08:45:38 2005
@@ -6,6 +6,8 @@
- Added date_timezone_set() function to set the timezone that the date
functions will use. (Derick)
- Implemented feature request #33452 (Year belonging to ISO week). (Derick)
+- Fixed memory corruption in pg_copy_from() in case the as_null parameter was
+ passed. (Derick)
- Fixed bug #33562 (date("") crashes). (Derick)
- Fixed bug #33536 (strtotime() defaults to now even on non time string).
(Derick)
http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.327&r2=1.328&ty=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.327 php-src/ext/pgsql/pgsql.c:1.328
--- php-src/ext/pgsql/pgsql.c:1.327 Tue May 10 19:12:31 2005
+++ php-src/ext/pgsql/pgsql.c Tue Jul 5 08:45:39 2005
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.327 2005/05/10 23:12:31 tony2001 Exp $ */
+/* $Id: pgsql.c,v 1.328 2005/07/05 12:45:39 derick Exp $ */
#include <stdlib.h>
@@ -3280,6 +3280,7 @@
zval **tmp;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
int table_name_len, pg_delim_len, pg_null_as_len;
+ int pg_null_as_free = 0;
char *query;
char *query_template = "COPY \"\" FROM STDIN DELIMITERS ':' WITH NULL
AS ''";
HashPosition pos;
@@ -3299,6 +3300,7 @@
}
if (!pg_null_as) {
pg_null_as = safe_estrdup("\\\\N");
+ pg_null_as_free = 1;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL
link", le_link, le_plink);
@@ -3311,7 +3313,9 @@
}
pgsql_result = PQexec(pgsql, query);
- efree(pg_null_as);
+ if (pg_null_as_free) {
+ efree(pg_null_as);
+ }
efree(query);
if (pgsql_result) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php