The following issues were found

tsl/test/sql/include/deparse_create.sql
1 issues
Syntax error at or near "\"
Syntax error

Line: 7 Column: 1

              
-- Lets create some tabels that we will try to deparse and recreate

\c :TEST_DBNAME :ROLE_SUPERUSER

SET ROLE :ROLE_DEFAULT_PERM_USER;

CREATE TABLE table1(time TIMESTAMP, v FLOAT8, c CHAR(10), x NUMERIC(10,4), i interval hour to minute);


            

Reported by SQLint.

tsl/test/sql/include/deparse_func.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.

\c :TEST_DBNAME :ROLE_SUPERUSER

CREATE OR REPLACE FUNCTION _timescaledb_internal.get_tabledef(tbl REGCLASS) RETURNS TEXT
AS :TSL_MODULE_PATHNAME, 'ts_test_get_tabledef' LANGUAGE C VOLATILE STRICT;

CREATE OR REPLACE FUNCTION tsl_test_deparse_drop_chunks(

            

Reported by SQLint.

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

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

              	int i;

	copy = palloc(nbytes);
	memcpy(copy, hc, nbytes);

	for (i = 0; i < hc->num_slices; i++)
		copy->slices[i] = ts_dimension_slice_copy(hc->slices[i]);

	return copy;

            

Reported by FlawFinder.

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

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

              
	copy = MemoryContextAlloc(aggcontext, sizeof(*copy) + bucket_bytes);
	copy->nbuckets = state->nbuckets;
	memcpy(copy->buckets, state->buckets, bucket_bytes);

	return copy;
}

/* ts_hist_combinefunc(internal, internal) => internal */

            

Reported by FlawFinder.

src/estimate.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: 72 Column: 40 CWE codes: 126

              	Expr *right;
	Expr *nonconst;

	if (list_length(opexpr->args) != 2 || strlen(function_name) != 1)
		return INVALID_ESTIMATE;

	left = linitial(opexpr->args);
	right = lsecond(opexpr->args);


            

Reported by FlawFinder.

tsl/test/sql/license.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.

\c :TEST_DBNAME :ROLE_CLUSTER_SUPERUSER;

SHOW timescaledb.license;
SELECT _timescaledb_internal.tsl_loaded();

            

Reported by SQLint.

src/debug_point.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: 60 Column: 63 CWE codes: 126

              static uint64
debug_point_name_to_id(const char *name)
{
	return DatumGetUInt32(hash_any((const unsigned char *) name, strlen(name)));
}

static void
debug_point_init(DebugPoint *point, const char *name)
{

            

Reported by FlawFinder.

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

Line: 68 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

              static char *
chunk_index_choose_name(const char *tabname, const char *main_index_name, Oid namespaceid)
{
	char buf[10];
	char *label = NULL;
	char *idxname;
	int n = 0;

	for (;;)

            

Reported by FlawFinder.

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

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

              
	old = MemoryContextSwitchTo(ti->mctx);
	chunk_data_node = palloc(sizeof(ChunkDataNode));
	memcpy(&chunk_data_node->fd, form, sizeof(FormData_chunk_data_node));
	chunk_data_node->foreign_server_oid = foreign_server->serverid;
	*nodes = lappend(*nodes, chunk_data_node);
	MemoryContextSwitchTo(old);

	if (should_free)

            

Reported by FlawFinder.

tsl/test/sql/remote_connection_cache.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.

\c :TEST_DBNAME :ROLE_SUPERUSER

\set DN_DBNAME_1 :TEST_DBNAME _1
\set DN_DBNAME_2 :TEST_DBNAME _2

CREATE FUNCTION _timescaledb_internal.test_remote_connection_cache()

            

Reported by SQLint.