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/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_common.h Examining data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/compat.h Examining data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/error.h Examining data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/pg_config.h Examining data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c Examining data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_common.c FINAL RESULTS: data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_common.c:185:11: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. switch (sscanf(date, _fmt_date, &year, &month, &day)) { data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_common.c:203:11: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. switch (sscanf(date, _fmt_datetime, &year, &month, &day, &hour, &min, &sec, &subsec)) { data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_common.c:245:18: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. tokens_read = sscanf(date, fmt_datetime, &year, &month, &day, &hour, &min, &sec, &hour_offset, &minute_offset); data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:22:8: [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. #undef vsnprintf data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:23:8: [4] (format) snprintf: 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. #undef snprintf data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:24:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. #undef sprintf data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:25:8: [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. #undef printf data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:208:3: [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(escaped_quotes + 1, escaped, quoted_length * sizeof(unsigned char)); data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:546:27: [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). insert_id = INT2NUM(atoi(PQgetvalue(response, 0, 0))); data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:549: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). affected_rows = INT2NUM(atoi(PQcmdTuples(response))); data/ruby-dataobjects-postgres-0.10.17/ext/do_postgres/do_postgres.c:553: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). affected_rows = INT2NUM(atoi(PQcmdTuples(response))); ANALYSIS SUMMARY: Hits = 11 Lines analyzed = 2480 in approximately 0.08 seconds (32545 lines/second) Physical Source Lines of Code (SLOC) = 1509 Hits@level = [0] 1 [1] 0 [2] 4 [3] 0 [4] 7 [5] 0 Hits@level+ = [0+] 12 [1+] 11 [2+] 11 [3+] 7 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 7.95229 [1+] 7.2896 [2+] 7.2896 [3+] 4.63883 [4+] 4.63883 [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.