aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-03-14 13:48:35 -0400
committerRobert Haas <rhaas@postgresql.org>2016-03-14 13:52:52 -0400
commit3adf9ced17dfa84faa209127b4499e5a5b995806 (patch)
treed52c7ea0bf14844e5ac9ef601ec254f0f2446b43 /src
parent2da75499879032d8d2f233ca42cc2efe48fd76ef (diff)
downloadpostgresql-3adf9ced17dfa84faa209127b4499e5a5b995806.tar.gz
postgresql-3adf9ced17dfa84faa209127b4499e5a5b995806.zip
Improve check for overly-long extensible node name.
The old code is bad for two reasons. First, it has an off-by-one error. Second, it won't help if you aren't running with assertions enabled. Per discussion, we want a check here in that case too. Author: KaiGai Kohei, adjusted by me. Reviewed-by: Petr Jelinek Discussion: 56E0D547.1030101@2ndquadrant.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/nodes/extensible.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/nodes/extensible.c b/src/backend/nodes/extensible.c
index e78a12bab7e..2473b658b17 100644
--- a/src/backend/nodes/extensible.c
+++ b/src/backend/nodes/extensible.c
@@ -51,7 +51,8 @@ RegisterExtensibleNodeMethods(const ExtensibleNodeMethods *methods)
100, &ctl, HASH_ELEM);
}
- Assert(strlen(methods->extnodename) <= EXTNODENAME_MAX_LEN);
+ if (strlen(methods->extnodename) >= EXTNODENAME_MAX_LEN)
+ elog(ERROR, "extensible node name is too long");
entry = (ExtensibleNodeEntry *) hash_search(extensible_node_methods,
methods->extnodename,