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/postgresql-plproxy-2.10.0/src/aatree.c Examining data/postgresql-plproxy-2.10.0/src/aatree.h Examining data/postgresql-plproxy-2.10.0/src/cluster.c Examining data/postgresql-plproxy-2.10.0/src/execute.c Examining data/postgresql-plproxy-2.10.0/src/function.c Examining data/postgresql-plproxy-2.10.0/src/main.c Examining data/postgresql-plproxy-2.10.0/src/plproxy.h Examining data/postgresql-plproxy-2.10.0/src/query.c Examining data/postgresql-plproxy-2.10.0/src/result.c Examining data/postgresql-plproxy-2.10.0/src/rowstamp.h Examining data/postgresql-plproxy-2.10.0/src/type.c FINAL RESULTS: data/postgresql-plproxy-2.10.0/src/main.c:69:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(msg, sizeof(msg), fmt, ap); data/postgresql-plproxy-2.10.0/src/execute.c:902:22: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. tag_part(cluster, random(), tag); data/postgresql-plproxy-2.10.0/src/cluster.c:272: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 nulls[1]; data/postgresql-plproxy-2.10.0/src/cluster.c:308:29: [2] (integer) atoi: 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). cf->connection_lifetime = atoi(val); data/postgresql-plproxy-2.10.0/src/cluster.c:310:23: [2] (integer) atoi: 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). cf->query_timeout = atoi(val); data/postgresql-plproxy-2.10.0/src/cluster.c:312:24: [2] (integer) atoi: 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). cf->disable_binary = atoi(val); data/postgresql-plproxy-2.10.0/src/cluster.c:314:25: [2] (integer) atoi: 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). cf->modular_mapping = atoi(val); data/postgresql-plproxy-2.10.0/src/cluster.c:319:7: [2] (integer) atoi: 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). if (atoi(val) > 0 && !did_warn) { data/postgresql-plproxy-2.10.0/src/cluster.c:537:24: [2] (integer) atoi: 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). modular_mapping = atoi(arg); data/postgresql-plproxy-2.10.0/src/execute.c:734: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 errbuf[256]; data/postgresql-plproxy-2.10.0/src/function.c:71: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(res, s, len); data/postgresql-plproxy-2.10.0/src/function.c:84:7: [2] (integer) atoi: 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). i = atoi(ident + 1) - 1; data/postgresql-plproxy-2.10.0/src/function.c:293: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 namebuf[NAMEDATALEN * 4 + 2 + 1 + 2 + 1]; data/postgresql-plproxy-2.10.0/src/main.c:65: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 msg[1024]; data/postgresql-plproxy-2.10.0/src/main.c:113:22: [2] (integer) atoi: 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). spos ? errposition(atoi(spos)) : 0, data/postgresql-plproxy-2.10.0/src/main.c:114:30: [2] (integer) atoi: 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). ipos ? internalerrposition(atoi(ipos)) : 0, data/postgresql-plproxy-2.10.0/src/plproxy.h:130: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 default_user[NAMEDATALEN]; data/postgresql-plproxy-2.10.0/src/plproxy.h:186:8: [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 *param_values[FUNC_MAX_ARGS]; /* Parameter values */ data/postgresql-plproxy-2.10.0/src/query.c:71: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 tmp[1 + 3 + 2 + NAMEDATALEN*2 + 1]; data/postgresql-plproxy-2.10.0/src/query.c:140: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(pq->arg_lookup, q->arg_lookup, len); data/postgresql-plproxy-2.10.0/src/query.c:279: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 arg_nulls[FUNC_MAX_ARGS]; data/postgresql-plproxy-2.10.0/src/type.c:272: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 namebuf[NAMEDATALEN * 4 + 2 + 1 + 2 + 1]; data/postgresql-plproxy-2.10.0/src/cluster.c:147:34: [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). memset(info->extra_connstr, 0, strlen(info->extra_connstr)); data/postgresql-plproxy-2.10.0/src/cluster.c:450:41: [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). *part_num = (int) strtoul(partname + strlen(*part_tag), &errptr, 10); data/postgresql-plproxy-2.10.0/src/cluster.c:476:40: [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). else if (strspn(arg, "0123456789") != strlen(arg)) data/postgresql-plproxy-2.10.0/src/cluster.c:675:38: [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). memset(userinfo->extra_connstr, 0, strlen(userinfo->extra_connstr)); data/postgresql-plproxy-2.10.0/src/function.c:68:14: [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). int len = strlen(s) + 1; ANALYSIS SUMMARY: Hits = 27 Lines analyzed = 5332 in approximately 0.17 seconds (31329 lines/second) Physical Source Lines of Code (SLOC) = 3458 Hits@level = [0] 6 [1] 5 [2] 20 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 33 [1+] 27 [2+] 22 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 9.54309 [1+] 7.80798 [2+] 6.36206 [3+] 0.578369 [4+] 0.289184 [5+] 0 Dot directories skipped = 2 (--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.