mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-01 19:45:33 +08:00
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
This commit is contained in:
parent
2da7549987
commit
3adf9ced17
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user