The following issues were found

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

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

              {
	CompressChunkDmlPath *path = (CompressChunkDmlPath *) palloc0(sizeof(CompressChunkDmlPath));

	memcpy(&path->cpath.path, subpath, sizeof(Path));
	path->cpath.path.type = T_CustomPath;
	path->cpath.path.pathtype = T_CustomScan;
	path->cpath.path.parent = subpath->parent;
	path->cpath.path.pathtarget = subpath->pathtarget;
	// path->cpath.path.param_info = subpath->param_info;

            

Reported by FlawFinder.

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

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

              	Path *subpath = ts_chunk_dispatch_path_create(root, mtpath, hypertable_rti, subplan_index);

	/* Copy costs, etc. from the subpath */
	memcpy(&sdpath->cpath.path, subpath, sizeof(Path));

	sdpath->cpath.path.type = T_CustomPath;
	sdpath->cpath.path.pathtype = T_CustomScan;
	sdpath->cpath.custom_paths = list_make1(subpath);
	sdpath->cpath.methods = &data_node_copy_path_methods;

            

Reported by FlawFinder.

tsl/src/nodes/decompress_chunk/planner.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: 168 Column: 35 CWE codes: 126

              			/*
			 * dropped columns have empty string
			 */
			if (IsA(lfirst(lc), String) && strlen(chunk_col->val.str) > 0)
			{
				tle = make_compressed_scan_targetentry(path, ht_attno, list_length(scan_tlist) + 1);
				scan_tlist = lappend(scan_tlist, tle);
			}
		}

            

Reported by FlawFinder.

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

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

              	ListCell *lc;
	double total_cost = 0, rows = 0;
	ChunkAppendPath *new = palloc(sizeof(ChunkAppendPath));
	memcpy(new, ca, sizeof(ChunkAppendPath));
	new->cpath.custom_paths = subpaths;

	foreach (lc, subpaths)
	{
		Path *child = lfirst(lc);

            

Reported by FlawFinder.

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

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

              void
prepared_stmt_close(PreparedStmt *stmt)
{
	char sql[64] = { '\0' };
	int ret;

	ret = snprintf(sql, sizeof(sql), "DEALLOCATE %s", stmt->stmt_name);

	if (ret < 0 || ret >= sizeof(sql))

            

Reported by FlawFinder.

test/sql/updates/setup.v3.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.v2.sql

\ir setup.continuous_aggs.sql

            

Reported by SQLint.

tsl/src/remote/data_fetcher.h
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 58 Column: 7 CWE codes: 362

              	int fetch_size;		/* # of tuples to fetch */
	int batch_count;	/* how many batches (parts of result set) we've done */

	bool open;
	bool eof;

	AsyncRequest *data_req; /* a request to fetch data */
} DataFetcher;


            

Reported by FlawFinder.

tsl/src/remote/data_format.c
1 issues
Possible null pointer dereference: type_io_param
Error

Line: 58 CWE codes: 476

              			func = pg_type->typinput;
			*is_binary = false;
		}
		*type_io_param = getTypeIOParam(type_tuple);
	}

	ReleaseSysCache(type_tuple);
	if (!OidIsValid(func))
		ereport(ERROR,

            

Reported by Cppcheck.

tsl/src/remote/dist_copy.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: 528 Column: 11 CWE codes: 126

              		{
			const char *delim_string = def_get_string(defel);

			Assert(strlen(delim_string) == 1);
			*delimiter = delim_string[0];
			delimiter_found = true;
		}
		else if (strcmp(defel->defname, "null") == 0)
			*null_string = def_get_string(defel);

            

Reported by FlawFinder.

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

Line: 24 Column: 14 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

              #ifdef DEBUG

static const DistTransactionEventHandler *event_handler = NULL;
static const char *eventnames[MAX_DTXN_EVENT] = {
	[DTXN_EVENT_ANY] = "any",
	[DTXN_EVENT_PRE_COMMIT] = "pre-commit",
	[DTXN_EVENT_WAIT_COMMIT] = "waiting-commit",
	[DTXN_EVENT_PRE_ABORT] = "pre-abort",
	[DTXN_EVENT_PRE_PREPARE] = "pre-prepare-transaction",

            

Reported by FlawFinder.