mirror of https://github.com/citusdata/citus.git
Fix hostname length check in StartNodeUserDatabaseConnection (#4363)
Copying string before hostname length check makes the check uselesspull/4357/head^2
parent
7f3d1182ed
commit
03bcccdee0
|
@ -257,7 +257,6 @@ StartNodeUserDatabaseConnection(uint32 flags, const char *hostname, int32 port,
|
|||
bool found;
|
||||
|
||||
/* do some minimal input checks */
|
||||
strlcpy(key.hostname, hostname, MAX_NODE_LENGTH);
|
||||
if (strlen(hostname) > MAX_NODE_LENGTH)
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
|
@ -265,6 +264,8 @@ StartNodeUserDatabaseConnection(uint32 flags, const char *hostname, int32 port,
|
|||
MAX_NODE_LENGTH)));
|
||||
}
|
||||
|
||||
strlcpy(key.hostname, hostname, MAX_NODE_LENGTH);
|
||||
|
||||
key.port = port;
|
||||
if (user)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue