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-unit-7.3/defined_units.h Examining data/postgresql-unit-7.3/float8out_unit.h Examining data/postgresql-unit-7.3/powers.c Examining data/postgresql-unit-7.3/powers.h Examining data/postgresql-unit-7.3/unit.c Examining data/postgresql-unit-7.3/unit.h Examining data/postgresql-unit-7.3/unitparse.tab.c Examining data/postgresql-unit-7.3/unitparse.tab.h FINAL RESULTS: data/postgresql-unit-7.3/unit.c:218:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. *output_p += sprintf(*output_p, "%s", "⁻"); data/postgresql-unit-7.3/unit.c:223:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. *output_p += sprintf(*output_p, "%s", superscripts[ascii_exp[i] - '0']); data/postgresql-unit-7.3/unit.c:257:16: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. *output_p += sprintf(*output_p, "%g " TIME_YEAR_NAME, years); data/postgresql-unit-7.3/unit.c:259:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. *output_p += sprintf(*output_p, " %s ", sign); data/postgresql-unit-7.3/unit.c:270:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. *output_p += sprintf(*output_p, " %s ", sign); data/postgresql-unit-7.3/unit.c:328:39: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define print_output(...) output_p += sprintf(output_p, __VA_ARGS__); data/postgresql-unit-7.3/unitparse.tab.c:653:21: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define YYFPRINTF fprintf data/postgresql-unit-7.3/defined_units.h:7:7: [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 *base_units[N_UNITS] = { data/postgresql-unit-7.3/float8out_unit.h:20:10: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. return strcpy(ascii, "NaN"); data/postgresql-unit-7.3/float8out_unit.h:23:11: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. return strcpy(ascii, "Infinity"); data/postgresql-unit-7.3/float8out_unit.h:25:11: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. return strcpy(ascii, "-Infinity"); data/postgresql-unit-7.3/unit.c:114:4: [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(unit_dim->units, si_derived_units[i].units, N_UNITS); data/postgresql-unit-7.3/unit.c:213:3: [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 ascii_exp[5]; data/postgresql-unit-7.3/unit.c:216:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(ascii_exp, "%d", e); data/postgresql-unit-7.3/unit.c:226:16: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. *output_p += sprintf(*output_p, "^%d", e); data/postgresql-unit-7.3/unit.c:268:16: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. *output_p += sprintf(*output_p, "%d d", days); data/postgresql-unit-7.3/unit.c:280:15: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. *output_p += sprintf(*output_p, "%02d:%02d:", h, m); data/postgresql-unit-7.3/unit.c:287:15: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. *output_p += sprintf(*output_p, "%.*f", ndig, t); data/postgresql-unit-7.3/unit.c:298:15: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. *output_p += sprintf(*output_p, " s"); data/postgresql-unit-7.3/unit.c:414:58: [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 *unit_name = derived_unit ? derived_unit->name : (char *)base_units[u_numerator]; data/postgresql-unit-7.3/unit.c:556: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(unit->units, pq_getmsgbytes(buf, N_UNITS), N_UNITS); data/postgresql-unit-7.3/unit.c:714: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(result->units, a->units, N_UNITS); data/postgresql-unit-7.3/unit.c:728: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(result->units, a->units, N_UNITS); data/postgresql-unit-7.3/unit.c:785: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(result->units, a->units, N_UNITS); data/postgresql-unit-7.3/unit.c:814: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(result->units, b->units, N_UNITS); data/postgresql-unit-7.3/unit.c:829: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(result->units, a->units, N_UNITS); data/postgresql-unit-7.3/unit.c:886: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(result->units, a->units, N_UNITS); data/postgresql-unit-7.3/unit.h:39:14: [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. extern const char *base_units[N_UNITS]; /* names of base units */ data/postgresql-unit-7.3/unit.h:43: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. signed char units[N_UNITS]; data/postgresql-unit-7.3/unit.h:52: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. signed char units[N_UNITS]; data/postgresql-unit-7.3/unit.h: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 name[UNIT_NAME_LENGTH]; data/postgresql-unit-7.3/unit.h:70: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 units[N_UNITS]; data/postgresql-unit-7.3/unit.h: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 name[UNIT_NAME_LENGTH]; data/postgresql-unit-7.3/unit.h:98: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(result->units, a->units, N_UNITS); data/postgresql-unit-7.3/unit.h:106: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(result->units, a->units, N_UNITS); data/postgresql-unit-7.3/unitparse.tab.c:899:3: [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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; data/postgresql-unit-7.3/unitparse.tab.c:1086:3: [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 yymsgbuf[128]; data/postgresql-unit-7.3/unit.c:240:16: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. *output_p += sprintf(*output_p, "-"); data/postgresql-unit-7.3/unit.c:284:16: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. *output_p += sprintf(*output_p, "0"); data/postgresql-unit-7.3/unitparse.tab.c:799: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). # define yystrlen strlen ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 3329 in approximately 0.18 seconds (18427 lines/second) Physical Source Lines of Code (SLOC) = 2362 Hits@level = [0] 2 [1] 3 [2] 30 [3] 0 [4] 7 [5] 0 Hits@level+ = [0+] 42 [1+] 40 [2+] 37 [3+] 7 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 17.7815 [1+] 16.9348 [2+] 15.6647 [3+] 2.96359 [4+] 2.96359 [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.