summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-04-22 00:31:55 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-04-22 00:31:55 +0000
commit8694cd135df5bd9c4e93ac96b619b6114c5790f0 (patch)
tree8589a67e06a3e656950307cbaade4251e2e4157f /ext
parentd641ba3eaec78693e85956d0731efcf2b84b0011 (diff)
downloadphp-git-8694cd135df5bd9c4e93ac96b619b6114c5790f0.tar.gz
Fixed possible crash inside pg_copy_(to|from) function if delimiter is more
then 1 character long.
Diffstat (limited to 'ext')
-rw-r--r--ext/pgsql/pgsql.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 30916a7bee..81f6749463 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2658,8 +2658,8 @@ PHP_FUNCTION(pg_copy_to)
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 @@ PHP_FUNCTION(pg_copy_from)
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);
}