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-qualstats-2.0.2/pg_qualstats.c FINAL RESULTS: data/pg-qualstats-2.0.2/pg_qualstats.c:605:24: [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. query_is_sampled = (random() <= (MAX_RANDOM_VALUE * data/pg-qualstats-2.0.2/pg_qualstats.c:234: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 constvalue[PGQS_CONSTANT_SIZE]; /* Textual representation of data/pg-qualstats-2.0.2/pg_qualstats.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 querytext[1]; data/pg-qualstats-2.0.2/pg_qualstats.c:919: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(&(dest->lrelid), data/pg-qualstats-2.0.2/pg_qualstats.c:1694: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(entry->constvalue, utf8const, len); data/pg-qualstats-2.0.2/pg_qualstats.c:759:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(queryEntry->querytext, context->querytext, pgqs_query_size); data/pg-qualstats-2.0.2/pg_qualstats.c:1352: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). strlen(constant), data/pg-qualstats-2.0.2/pg_qualstats.c:1356:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(entry->constvalue, utf8const, strlen(utf8const)); data/pg-qualstats-2.0.2/pg_qualstats.c:1356:42: [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). strncpy(entry->constvalue, utf8const, strlen(utf8const)); data/pg-qualstats-2.0.2/pg_qualstats.c:1422:46: [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). if (strspn(extval, "0123456789+-eE.") == strlen(extval)) data/pg-qualstats-2.0.2/pg_qualstats.c:1680:19: [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). strlen(buf->data), data/pg-qualstats-2.0.2/pg_qualstats.c:1683:11: [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). len = strlen(utf8const); data/pg-qualstats-2.0.2/pg_qualstats.c:2109:8: [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). strlen(entry->constvalue), ANALYSIS SUMMARY: Hits = 13 Lines analyzed = 2520 in approximately 0.07 seconds (35510 lines/second) Physical Source Lines of Code (SLOC) = 1903 Hits@level = [0] 0 [1] 8 [2] 4 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 13 [1+] 13 [2+] 5 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 6.83132 [1+] 6.83132 [2+] 2.62743 [3+] 0.525486 [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.