Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/pg-catcheck-1.2.0/check_attribute.c Examining data/pg-catcheck-1.2.0/check_class.c Examining data/pg-catcheck-1.2.0/check_depend.c Examining data/pg-catcheck-1.2.0/check_oids.c Examining data/pg-catcheck-1.2.0/compat.c Examining data/pg-catcheck-1.2.0/compat.h Examining data/pg-catcheck-1.2.0/definitions.c Examining data/pg-catcheck-1.2.0/log.c Examining data/pg-catcheck-1.2.0/pg_catcheck.c Examining data/pg-catcheck-1.2.0/pg_catcheck.h Examining data/pg-catcheck-1.2.0/pgrhash.c Examining data/pg-catcheck-1.2.0/select_from_relations.c FINAL RESULTS: data/pg-catcheck-1.2.0/compat.h:36:29: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define PG_PRINTF_ATTRIBUTE printf data/pg-catcheck-1.2.0/log.c:40:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stdout, fmt, args); data/pg-catcheck-1.2.0/log.c:42:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/pg-catcheck-1.2.0/log.c:67:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stdout, fmt, args); data/pg-catcheck-1.2.0/pg_catcheck.c:112:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((env = getenv("PGHOST")) != NULL && *env != '\0') data/pg-catcheck-1.2.0/pg_catcheck.c:114:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((env = getenv("PGPORT")) != NULL && *env != '\0') data/pg-catcheck-1.2.0/pg_catcheck.c:116:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. else if ((env = getenv("PGUSER")) != NULL && *env != '\0') data/pg-catcheck-1.2.0/pg_catcheck.c:119:14: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long(argc, argv, "h:p:U:t:T:g:c:C:qv", long_options, &optindex)) != -1) data/pg-catcheck-1.2.0/pg_catcheck.c:177:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((env = getenv("PGDATABASE")) != NULL && *env != '\0') data/pg-catcheck-1.2.0/check_class.c:39:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[512]; data/pg-catcheck-1.2.0/check_class.c:40:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *keys[2]; data/pg-catcheck-1.2.0/check_depend.c:405:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *vals[2]; data/pg-catcheck-1.2.0/check_oids.c:95:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/pg-catcheck-1.2.0/check_oids.c:123:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, val, s - val); data/pg-catcheck-1.2.0/check_oids.c:137:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/pg-catcheck-1.2.0/check_oids.c:174:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, val, s - val); data/pg-catcheck-1.2.0/pg_catcheck.c:238:19: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). remote_is_edb = atol(PQgetvalue(res, 0, 0)); data/pg-catcheck-1.2.0/pg_catcheck.c:417:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *keywords[PARAMS_ARRAY_SIZE]; data/pg-catcheck-1.2.0/pg_catcheck.c:418:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *values[PARAMS_ARRAY_SIZE]; data/pg-catcheck-1.2.0/pg_catcheck.c:451:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char passbuf[100]; data/pg-catcheck-1.2.0/pgrhash.c:61:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ht->keycols, keycols, sizeof(int) * nkeycols); data/pg-catcheck-1.2.0/pgrhash.c:106:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *keyvals[MAX_KEY_COLS]; data/pg-catcheck-1.2.0/select_from_relations.c:116:43: [1] (buffer) 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) (CWE-126). PQescapeIdentifier(conn, nspname, strlen(nspname)), data/pg-catcheck-1.2.0/select_from_relations.c:117:45: [1] (buffer) 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) (CWE-126). PQescapeIdentifier(conn, tablename, strlen(tablename))); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 4060 in approximately 0.13 seconds (32296 lines/second) Physical Source Lines of Code (SLOC) = 2806 Hits@level = [0] 39 [1] 2 [2] 13 [3] 5 [4] 4 [5] 0 Hits@level+ = [0+] 63 [1+] 24 [2+] 22 [3+] 9 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 22.4519 [1+] 8.5531 [2+] 7.84034 [3+] 3.20741 [4+] 1.42552 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.