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-pgmp-1.0.4/sandbox/hello/hello.c Examining data/postgresql-pgmp-1.0.4/src/pgmp-impl.h Examining data/postgresql-pgmp-1.0.4/src/pgmp.c Examining data/postgresql-pgmp-1.0.4/src/pgmp_utils.c Examining data/postgresql-pgmp-1.0.4/src/pgmp_utils.h Examining data/postgresql-pgmp-1.0.4/src/pmpq.c Examining data/postgresql-pgmp-1.0.4/src/pmpq.h Examining data/postgresql-pgmp-1.0.4/src/pmpq_agg.c Examining data/postgresql-pgmp-1.0.4/src/pmpq_arith.c Examining data/postgresql-pgmp-1.0.4/src/pmpq_io.c Examining data/postgresql-pgmp-1.0.4/src/pmpz.c Examining data/postgresql-pgmp-1.0.4/src/pmpz.h Examining data/postgresql-pgmp-1.0.4/src/pmpz_agg.c Examining data/postgresql-pgmp-1.0.4/src/pmpz_arith.c Examining data/postgresql-pgmp-1.0.4/src/pmpz_bits.c Examining data/postgresql-pgmp-1.0.4/src/pmpz_io.c Examining data/postgresql-pgmp-1.0.4/src/pmpz_rand.c Examining data/postgresql-pgmp-1.0.4/src/pmpz_roots.c Examining data/postgresql-pgmp-1.0.4/src/pmpz_theor.c FINAL RESULTS: data/postgresql-pgmp-1.0.4/src/pgmp.c:110:11: [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). maj = atoi(gmp_version); data/postgresql-pgmp-1.0.4/src/pgmp.c:115:11: [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). min = atoi(p + 1); data/postgresql-pgmp-1.0.4/src/pgmp.c:120:13: [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). patch = atoi(p + 1); data/postgresql-pgmp-1.0.4/src/pmpq.c:60:13: [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->data + nalloc, LIMBS(den), dsize * sizeof(mp_limb_t)); data/postgresql-pgmp-1.0.4/src/pmpq.c:70:13: [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->data + dsize, LIMBS(num), nalloc * sizeof(mp_limb_t)); data/postgresql-pgmp-1.0.4/src/pmpq.h:30: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 vl_len_[4]; /* varlena header */ data/postgresql-pgmp-1.0.4/src/pmpq_arith.c:42:5: [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, pq1, VARSIZE(pq1)); data/postgresql-pgmp-1.0.4/src/pmpz.h:30: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 vl_len_[4]; /* varlena header */ data/postgresql-pgmp-1.0.4/src/pmpz_arith.c:48:5: [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, pz1, VARSIZE(pz1)); data/postgresql-pgmp-1.0.4/src/pmpq_io.c:81:16: [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). ell = (strlen(str) > maxchars) ? "..." : ""; data/postgresql-pgmp-1.0.4/src/pmpq_io.c:229: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). pd = sd = (char *)palloc(strlen(sn)); data/postgresql-pgmp-1.0.4/src/pmpq_io.c:396:21: [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). end = buf + strlen(buf); data/postgresql-pgmp-1.0.4/src/pmpz_io.c:46:16: [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). ell = (strlen(str) > maxchars) ? "..." : ""; data/postgresql-pgmp-1.0.4/src/pmpz_io.c:79:16: [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). ell = (strlen(str) > maxchars) ? "..." : ""; ANALYSIS SUMMARY: Hits = 14 Lines analyzed = 3361 in approximately 0.10 seconds (34703 lines/second) Physical Source Lines of Code (SLOC) = 2053 Hits@level = [0] 1 [1] 5 [2] 9 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 15 [1+] 14 [2+] 9 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 7.30638 [1+] 6.81929 [2+] 4.38383 [3+] 0 [4+] 0 [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.