diff options
author | Remi Collet <remi@php.net> | 2015-05-20 08:14:02 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2015-05-20 08:14:02 +0200 |
commit | 8ad4a21c44fa2256c7c26beca9d94edd89162649 (patch) | |
tree | 246296d6a016f449df0576036f5c00e87c4c788f | |
parent | 890a28d4b97b5785f155618fc34134acb77f7a64 (diff) | |
parent | 6da4feac358f407c7958eeaa1b128ca88d6c40d9 (diff) | |
download | php-git-8ad4a21c44fa2256c7c26beca9d94edd89162649.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
NEWS 5.6
NEWS 5.5
Fixed Bug #69667 segfault in php_pgsql_meta_data
fix test output (32bits)
Conflicts:
ext/pgsql/pgsql.c
-rw-r--r-- | ext/pgsql/pg_insert_002.phpt | 27 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 9 |
2 files changed, 34 insertions, 2 deletions
diff --git a/ext/pgsql/pg_insert_002.phpt b/ext/pgsql/pg_insert_002.phpt new file mode 100644 index 0000000000..1393f5f330 --- /dev/null +++ b/ext/pgsql/pg_insert_002.phpt @@ -0,0 +1,27 @@ +--TEST-- +PostgreSQL pg_select() - basic test using schema +--SKIPIF-- +<?php include("skipif.inc"); ?> +--FILE-- +<?php + +include('config.inc'); + +$conn = pg_connect($conn_str); + +foreach (array('', '.', '..') as $table) { + var_dump(pg_insert($conn, '', array('id' => 1, 'id2' => 1))); +} +?> +Done +--EXPECTF-- + +Warning: pg_insert(): The table name must be specified in %s on line %d +bool(false) + +Warning: pg_insert(): The table name must be specified in %s on line %d +bool(false) + +Warning: pg_insert(): The table name must be specified in %s on line %d +bool(false) +Done
\ No newline at end of file diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 6a86b8941b..a65b7a0aa9 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -5504,7 +5504,11 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z src = estrdup(table_name); tmp_name = php_strtok_r(src, ".", &tmp_name2); - + if (!tmp_name) { + efree(src); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The table name must be specified"); + return FAILURE; + } if (!tmp_name2 || !*tmp_name2) { /* Default schema */ tmp_name2 = tmp_name; @@ -6502,7 +6506,8 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const char *table) /* {{{ */ { - char *table_copy, *escaped, *token, *tmp; + char *table_copy, *escaped, *tmp; + const char *token; size_t len; /* schame.table should be "schame"."table" */ |