Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3adf9ce

Browse files
committed
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
1 parent 2da7549 commit 3adf9ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/nodes/extensible.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ RegisterExtensibleNodeMethods(const ExtensibleNodeMethods *methods)
5151
100, &ctl, HASH_ELEM);
5252
}
5353

54-
Assert(strlen(methods->extnodename) <= EXTNODENAME_MAX_LEN);
54+
if (strlen(methods->extnodename) >= EXTNODENAME_MAX_LEN)
55+
elog(ERROR, "extensible node name is too long");
5556

5657
entry = (ExtensibleNodeEntry *) hash_search(extensible_node_methods,
5758
methods->extnodename,

0 commit comments

Comments
 (0)