The following issues were found

test/sql/updates/setup.v1.sql
1 issues
Syntax error at or near "\"
Syntax error

Line: 5 Column: 1

              -- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.

\ir setup.bigint.sql
\ir setup.insert_bigint.v1.sql
\ir setup.timestamp.sql
\ir setup.insert_timestamp.sql

            

Reported by SQLint.

tsl/src/remote/stmt_params.c
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 128 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	Assert(params->num_params == idx);

	for (tup_cnt = 1; tup_cnt < params->num_tuples; tup_cnt++)
		memcpy(params->formats + tup_cnt * params->num_params,
			   params->formats,
			   sizeof(int) * params->num_params);

	MemoryContextSwitchTo(old);
	return params;

            

Reported by FlawFinder.

tsl/src/remote/tuplefactory.c
1 issues
Possible null pointer dereference: ss
Error

Line: 189 CWE codes: 476

              	if (NULL != rel)
		tupdesc = RelationGetDescr(rel);
	else
		tupdesc = ss->ss_ScanTupleSlot->tts_tupleDescriptor;

	tf =
		tuplefactory_create_common(tupdesc, retrieved_attrs, !ts_guc_enable_connection_binary_data);
	tf->errpos.rel = rel;
	tf->errpos.cur_attno = 0;

            

Reported by Cppcheck.

tsl/src/remote/txn_id.h
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 41 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              typedef struct RemoteTxnId
{
	uint8 version;
	char reserved[3]; /* not currently serialized */
	TransactionId xid;
	TSConnectionId id;
} RemoteTxnId;

extern RemoteTxnId *remote_txn_id_create(TransactionId xid, TSConnectionId id);

            

Reported by FlawFinder.

tsl/src/reorder.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 948 Column: 4 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              		if (OidIsValid(newrel->rd_rel->reltoastrelid))
		{
			Oid toastidx;
			char NewToastName[NAMEDATALEN];

			/* Get the associated valid index to be renamed */
			toastidx = toast_get_valid_index(newrel->rd_rel->reltoastrelid, AccessShareLock);

			/* rename the toast table ... */

            

Reported by FlawFinder.

tsl/src/telemetry.c
1 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 61 Column: 38 CWE codes: 126

              	/* distributed_db */
	distributed_db_key.type = jbvString;
	distributed_db_key.val.string.val = DISTRIBUTED_DB_KEY;
	distributed_db_key.val.string.len = strlen(DISTRIBUTED_DB_KEY);
	pushJsonbValue(parse_state, WJB_KEY, &distributed_db_key);
	pushJsonbValue(parse_state, WJB_BEGIN_OBJECT, NULL);
	tsl_telemetry_add_distributed_database_info(*parse_state);
	pushJsonbValue(parse_state, WJB_END_OBJECT, NULL);
}

            

Reported by FlawFinder.

tsl/test/shared/sql/constify_timestamptz_op_interval.sql
1 issues
Syntax error at or near "\"
Syntax error

Line: 5 Column: 1

              -- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.

\set PREFIX 'EXPLAIN (costs off)'
-- we disable ChunkAppend and ConstraintAwareAppend here to make the exclusion easier to spot
-- otherwise those would remove the chunks from the plan during execution

SET timescaledb.enable_chunk_append TO FALSE;


            

Reported by SQLint.

test/sql/updates/setup.repair.sql
1 issues
Syntax error at or near "\"
Syntax error

Line: 134 Column: 1

                 ORDER BY dimension_slice_id
);

\echo **** Expected repairs ****
WITH unparsed_slices AS (
    SELECT dimension_id,
	   dimension_slice_id,
	   hypertable,
	   constraint_name,

            

Reported by SQLint.

test/sql/updates/setup.check.sql
1 issues
Syntax error at or near "\"
Syntax error

Line: 5 Column: 1

              -- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.

\echo **** Missing dimension slices ****
SELECT hypertable_id,
       (
	   SELECT format('%I.%I', schema_name, table_name)::regclass
	   FROM _timescaledb_catalog.hypertable ht
	   WHERE ht.id = ch.hypertable_id

            

Reported by SQLint.

test/sql/updates/post.v7.sql
1 issues
Syntax error at or near "\"
Syntax error

Line: 5 Column: 1

              -- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.

\ir post.catalog.sql
\ir post.insert.sql
\ir post.integrity_test.sql
\ir catalog_missing_columns.sql
\ir post.compression.sql
\ir post.continuous_aggs.v2.sql

            

Reported by SQLint.