derick          Tue Jul  5 08:47:07 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src    NEWS 
    /php-src/ext/pgsql  pgsql.c 
  Log:
  - MFH: Fixed memory corruption in pg_copy_from() in case the as_null 
parameter was
    passed.
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.448&r2=1.1760.2.449&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.448 php-src/NEWS:1.1760.2.449
--- php-src/NEWS:1.1760.2.448   Mon Jul  4 08:47:26 2005
+++ php-src/NEWS        Tue Jul  5 08:47:05 2005
@@ -9,6 +9,8 @@
 - Added PHP_INT_MAX and PHP_INT_SIZE as predefined constants. (Andrey)
 - Changed sha1_file() and md5_file() functions to use streams instead of
   low level IO. (Uwe)
+- Fixed memory corruption in pg_copy_from() in case the as_null parameter was
+  passed. (Derick)
 - Fixed ext/mysqli to allocate less memory when fetching bound params
   of type (MEDIUM|LONG)BLOB/(MEDIUM|LONG)TEXT. (Andrey)
 - Fixed memory corruption in ImageTTFText() with 64bit systems. (Andrey)
http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.311.2.4&r2=1.311.2.5&ty=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.311.2.4 php-src/ext/pgsql/pgsql.c:1.311.2.5
--- php-src/ext/pgsql/pgsql.c:1.311.2.4 Tue May 10 19:15:24 2005
+++ php-src/ext/pgsql/pgsql.c   Tue Jul  5 08:47:06 2005
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.311.2.4 2005/05/10 23:15:24 tony2001 Exp $ */
+/* $Id: pgsql.c,v 1.311.2.5 2005/07/05 12:47:06 derick Exp $ */
 
 #include <stdlib.h>
 
@@ -2750,6 +2750,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;
@@ -2769,6 +2770,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);
@@ -2781,7 +2783,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

Reply via email to