iliaa           Wed Apr 21 20:31:57 2004 EDT

  Modified files:              
    /php-src/ext/pgsql  pgsql.c 
  Log:
  Fixed possible crash inside pg_copy_(to|from) function if delimiter is more
  then 1 character long.
  
  
http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.309&r2=1.310&ty=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.309 php-src/ext/pgsql/pgsql.c:1.310
--- php-src/ext/pgsql/pgsql.c:1.309     Wed Mar 17 20:34:58 2004
+++ php-src/ext/pgsql/pgsql.c   Wed Apr 21 20:31:55 2004
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.309 2004/03/18 01:34:58 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.310 2004/04/22 00:31:55 iliaa Exp $ */
 
 #include <stdlib.h>
 
@@ -2658,8 +2658,8 @@
        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", 
le_link, le_plink);
 
        query = (char *)emalloc(strlen(query_template) + strlen(table_name) + 
strlen(pg_null_as) + 1);
-       sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%s' WITH NULL AS '%s'",
-                       table_name,     pg_delim, pg_null_as);
+       sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'",
+                       table_name, *pg_delim, pg_null_as);
 
        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
@@ -2768,8 +2768,8 @@
        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", 
le_link, le_plink);
 
        query = (char *)emalloc(strlen(query_template) + strlen(table_name) + 
strlen(pg_null_as) + 1);
-       sprintf(query, "COPY \"%s\" FROM STDIN DELIMITERS '%s' WITH NULL AS '%s'",
-                       table_name, pg_delim, pg_null_as);
+       sprintf(query, "COPY \"%s\" FROM STDIN DELIMITERS '%c' WITH NULL AS '%s'",
+                       table_name, *pg_delim, pg_null_as);
        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to