From ffa2d37e5fbd1243f918f622113d6e371667e5a0 Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Mon, 5 Aug 2019 07:48:41 -0700 Subject: Require the schema qualification in pg_temp.type_name(arg). Commit aa27977fe21a7dfa4da4376ad66ae37cb8f0d0b5 introduced this restriction for pg_temp.function_name(arg); do likewise for types created in temporary schemas. Programs that this breaks should add "pg_temp." schema qualification or switch to arg::type_name syntax. Back-patch to 9.4 (all supported versions). Reviewed by Tom Lane. Reported by Tom Lane. Security: CVE-2019-10208 --- src/include/catalog/namespace.h | 1 + src/include/parser/parse_type.h | 3 +++ 2 files changed, 4 insertions(+) (limited to 'src/include') diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h index 672db81d91c..187d76de18a 100644 --- a/src/include/catalog/namespace.h +++ b/src/include/catalog/namespace.h @@ -77,6 +77,7 @@ extern Oid RelnameGetRelid(const char *relname); extern bool RelationIsVisible(Oid relid); extern Oid TypenameGetTypid(const char *typname); +extern Oid TypenameGetTypidExtended(const char *typname, bool temp_ok); extern bool TypeIsVisible(Oid typid); extern FuncCandidateList FuncnameGetCandidates(List *names, diff --git a/src/include/parser/parse_type.h b/src/include/parser/parse_type.h index f90ea9b7ecf..b243c64383d 100644 --- a/src/include/parser/parse_type.h +++ b/src/include/parser/parse_type.h @@ -21,6 +21,9 @@ typedef HeapTuple Type; extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool missing_ok); +extern Type LookupTypeNameExtended(ParseState *pstate, + const TypeName *typeName, int32 *typmod_p, + bool temp_ok, bool missing_ok); extern Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, bool missing_ok); extern Type typenameType(ParseState *pstate, const TypeName *typeName, -- cgit v1.2.3