mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 11:45:11 +08:00
Fix uninitialized variable in data node validation
Initialize a boolean variable used to check for a compatible extension on a data node. Leaving it uninitialized might lead to a potential read of a garbage value and unpredictible behavior.
This commit is contained in:
parent
05319cd424
commit
e284b2dfc0
@ -559,7 +559,7 @@ connect_for_bootstrapping(const char *node_name, const char *const host, int32 p
|
|||||||
return remote_connection_open_with_options_nothrow(node_name, node_options);
|
return remote_connection_open_with_options_nothrow(node_name, node_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Validate that compatible extension is available on the data node.
|
* Validate that compatible extension is available on the data node.
|
||||||
*
|
*
|
||||||
* We check all available extension versions. Since we are connected to
|
* We check all available extension versions. Since we are connected to
|
||||||
@ -573,9 +573,12 @@ connect_for_bootstrapping(const char *node_name, const char *const host, int32 p
|
|||||||
static void
|
static void
|
||||||
data_node_validate_extension_availability(TSConnection *conn)
|
data_node_validate_extension_availability(TSConnection *conn)
|
||||||
{
|
{
|
||||||
bool compatible;
|
StringInfo concat_versions = makeStringInfo();
|
||||||
|
bool compatible = false;
|
||||||
|
PGresult *res;
|
||||||
|
int i;
|
||||||
|
|
||||||
PGresult *res =
|
res =
|
||||||
remote_connection_execf(conn,
|
remote_connection_execf(conn,
|
||||||
"SELECT version FROM pg_available_extension_versions WHERE name = "
|
"SELECT version FROM pg_available_extension_versions WHERE name = "
|
||||||
"%s AND version ~ '\\d+.\\d+.\\d+.*' ORDER BY version DESC",
|
"%s AND version ~ '\\d+.\\d+.\\d+.*' ORDER BY version DESC",
|
||||||
@ -593,11 +596,10 @@ data_node_validate_extension_availability(TSConnection *conn)
|
|||||||
|
|
||||||
Assert(PQnfields(res) == 1);
|
Assert(PQnfields(res) == 1);
|
||||||
|
|
||||||
int i;
|
|
||||||
StringInfo concat_versions = makeStringInfo();
|
|
||||||
bool old_version;
|
|
||||||
for (i = 0; i < PQntuples(res); i++)
|
for (i = 0; i < PQntuples(res); i++)
|
||||||
{
|
{
|
||||||
|
bool old_version = false;
|
||||||
|
|
||||||
appendStringInfo(concat_versions, "%s, ", PQgetvalue(res, i, 0));
|
appendStringInfo(concat_versions, "%s, ", PQgetvalue(res, i, 0));
|
||||||
compatible = dist_util_is_compatible_version(PQgetvalue(res, i, 0),
|
compatible = dist_util_is_compatible_version(PQgetvalue(res, i, 0),
|
||||||
TIMESCALEDB_VERSION,
|
TIMESCALEDB_VERSION,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user