mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Tighten pg_get_object_address argument checking
For publication schemas (OBJECT_PUBLICATION_NAMESPACE) and user mappings (OBJECT_USER_MAPPING), pg_get_object_address() checked the array length of the second argument, but not of the first argument. If the first argument was too long, it would just silently ignore everything but the first argument. Fix that by checking the length of the first argument as well. Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/caaef70b-a874-1088-92ef-5ac38269c33b%40enterprisedb.com
This commit is contained in:
parent
1d3955266a
commit
ab7032b3a8
@ -2239,10 +2239,16 @@ pg_get_object_address(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
switch (type)
|
||||
{
|
||||
case OBJECT_PUBLICATION_NAMESPACE:
|
||||
case OBJECT_USER_MAPPING:
|
||||
if (list_length(name) != 1)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("name list length must be exactly %d", 1)));
|
||||
/* fall through to check args length */
|
||||
/* FALLTHROUGH */
|
||||
case OBJECT_DOMCONSTRAINT:
|
||||
case OBJECT_CAST:
|
||||
case OBJECT_USER_MAPPING:
|
||||
case OBJECT_PUBLICATION_NAMESPACE:
|
||||
case OBJECT_PUBLICATION_REL:
|
||||
case OBJECT_DEFACL:
|
||||
case OBJECT_TRANSFORM:
|
||||
|
@ -105,7 +105,7 @@ BEGIN
|
||||
('text search template'), ('text search configuration'),
|
||||
('policy'), ('user mapping'), ('default acl'), ('transform'),
|
||||
('operator of access method'), ('function of access method'),
|
||||
('publication relation')
|
||||
('publication namespace'), ('publication relation')
|
||||
LOOP
|
||||
FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}')
|
||||
LOOP
|
||||
@ -285,10 +285,10 @@ WARNING: error for policy,{eins,zwei,drei},{}: schema "eins" does not exist
|
||||
WARNING: error for policy,{eins,zwei,drei},{integer}: schema "eins" does not exist
|
||||
WARNING: error for user mapping,{eins},{}: argument list length must be exactly 1
|
||||
WARNING: error for user mapping,{eins},{integer}: user mapping for user "eins" on server "integer" does not exist
|
||||
WARNING: error for user mapping,{addr_nsp,zwei},{}: argument list length must be exactly 1
|
||||
WARNING: error for user mapping,{addr_nsp,zwei},{integer}: user mapping for user "addr_nsp" on server "integer" does not exist
|
||||
WARNING: error for user mapping,{eins,zwei,drei},{}: argument list length must be exactly 1
|
||||
WARNING: error for user mapping,{eins,zwei,drei},{integer}: user mapping for user "eins" on server "integer" does not exist
|
||||
WARNING: error for user mapping,{addr_nsp,zwei},{}: name list length must be exactly 1
|
||||
WARNING: error for user mapping,{addr_nsp,zwei},{integer}: name list length must be exactly 1
|
||||
WARNING: error for user mapping,{eins,zwei,drei},{}: name list length must be exactly 1
|
||||
WARNING: error for user mapping,{eins,zwei,drei},{integer}: name list length must be exactly 1
|
||||
WARNING: error for default acl,{eins},{}: argument list length must be exactly 1
|
||||
WARNING: error for default acl,{eins},{integer}: unrecognized default ACL object type "i"
|
||||
WARNING: error for default acl,{addr_nsp,zwei},{}: argument list length must be exactly 1
|
||||
@ -313,6 +313,12 @@ WARNING: error for function of access method,{addr_nsp,zwei},{}: name list leng
|
||||
WARNING: error for function of access method,{addr_nsp,zwei},{integer}: name list length must be at least 3
|
||||
WARNING: error for function of access method,{eins,zwei,drei},{}: argument list length must be exactly 2
|
||||
WARNING: error for function of access method,{eins,zwei,drei},{integer}: argument list length must be exactly 2
|
||||
WARNING: error for publication namespace,{eins},{}: argument list length must be exactly 1
|
||||
WARNING: error for publication namespace,{eins},{integer}: schema "eins" does not exist
|
||||
WARNING: error for publication namespace,{addr_nsp,zwei},{}: name list length must be exactly 1
|
||||
WARNING: error for publication namespace,{addr_nsp,zwei},{integer}: name list length must be exactly 1
|
||||
WARNING: error for publication namespace,{eins,zwei,drei},{}: name list length must be exactly 1
|
||||
WARNING: error for publication namespace,{eins,zwei,drei},{integer}: name list length must be exactly 1
|
||||
WARNING: error for publication relation,{eins},{}: argument list length must be exactly 1
|
||||
WARNING: error for publication relation,{eins},{integer}: relation "eins" does not exist
|
||||
WARNING: error for publication relation,{addr_nsp,zwei},{}: argument list length must be exactly 1
|
||||
|
@ -98,7 +98,7 @@ BEGIN
|
||||
('text search template'), ('text search configuration'),
|
||||
('policy'), ('user mapping'), ('default acl'), ('transform'),
|
||||
('operator of access method'), ('function of access method'),
|
||||
('publication relation')
|
||||
('publication namespace'), ('publication relation')
|
||||
LOOP
|
||||
FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}')
|
||||
LOOP
|
||||
|
Loading…
x
Reference in New Issue
Block a user