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/psycopg2-2.8.5/psycopg/microprotocols.c Examining data/psycopg2-2.8.5/psycopg/adapter_asis.c Examining data/psycopg2-2.8.5/psycopg/adapter_binary.c Examining data/psycopg2-2.8.5/psycopg/adapter_pboolean.h Examining data/psycopg2-2.8.5/psycopg/adapter_pdecimal.c Examining data/psycopg2-2.8.5/psycopg/adapter_mxdatetime.h Examining data/psycopg2-2.8.5/psycopg/replication_cursor_type.c Examining data/psycopg2-2.8.5/psycopg/psycopg.h Examining data/psycopg2-2.8.5/psycopg/adapter_binary.h Examining data/psycopg2-2.8.5/psycopg/replication_message_type.c Examining data/psycopg2-2.8.5/psycopg/adapter_list.c Examining data/psycopg2-2.8.5/psycopg/adapter_mxdatetime.c Examining data/psycopg2-2.8.5/psycopg/notify_type.c Examining data/psycopg2-2.8.5/psycopg/xid.h Examining data/psycopg2-2.8.5/psycopg/adapter_pfloat.h Examining data/psycopg2-2.8.5/psycopg/libpq_support.c Examining data/psycopg2-2.8.5/psycopg/replication_connection.h Examining data/psycopg2-2.8.5/psycopg/libpq_support.h Examining data/psycopg2-2.8.5/psycopg/cursor_int.c Examining data/psycopg2-2.8.5/psycopg/adapter_pdecimal.h Examining data/psycopg2-2.8.5/psycopg/microprotocols.h Examining data/psycopg2-2.8.5/psycopg/typecast.h Examining data/psycopg2-2.8.5/psycopg/typecast_mxdatetime.c Examining data/psycopg2-2.8.5/psycopg/replication_cursor.h Examining data/psycopg2-2.8.5/psycopg/connection_int.c Examining data/psycopg2-2.8.5/psycopg/utils.c Examining data/psycopg2-2.8.5/psycopg/aix_support.c Examining data/psycopg2-2.8.5/psycopg/error_type.c Examining data/psycopg2-2.8.5/psycopg/error.h Examining data/psycopg2-2.8.5/psycopg/cursor_type.c Examining data/psycopg2-2.8.5/psycopg/microprotocols_proto.h Examining data/psycopg2-2.8.5/psycopg/notify.h Examining data/psycopg2-2.8.5/psycopg/green.c Examining data/psycopg2-2.8.5/psycopg/pqpath.c Examining data/psycopg2-2.8.5/psycopg/microprotocols_proto.c Examining data/psycopg2-2.8.5/psycopg/config.h Examining data/psycopg2-2.8.5/psycopg/diagnostics_type.c Examining data/psycopg2-2.8.5/psycopg/typecast_binary.h Examining data/psycopg2-2.8.5/psycopg/python.h Examining data/psycopg2-2.8.5/psycopg/typecast_binary.c Examining data/psycopg2-2.8.5/psycopg/adapter_pint.h Examining data/psycopg2-2.8.5/psycopg/conninfo.h Examining data/psycopg2-2.8.5/psycopg/aix_support.h Examining data/psycopg2-2.8.5/psycopg/psycopgmodule.c Examining data/psycopg2-2.8.5/psycopg/adapter_qstring.c Examining data/psycopg2-2.8.5/psycopg/typecast_builtins.c Examining data/psycopg2-2.8.5/psycopg/bytes_format.c Examining data/psycopg2-2.8.5/psycopg/solaris_support.h Examining data/psycopg2-2.8.5/psycopg/column_type.c Examining data/psycopg2-2.8.5/psycopg/typecast.c Examining data/psycopg2-2.8.5/psycopg/typecast_datetime.c Examining data/psycopg2-2.8.5/psycopg/adapter_qstring.h Examining data/psycopg2-2.8.5/psycopg/diagnostics.h Examining data/psycopg2-2.8.5/psycopg/utils.h Examining data/psycopg2-2.8.5/psycopg/adapter_datetime.h Examining data/psycopg2-2.8.5/psycopg/adapter_pboolean.c Examining data/psycopg2-2.8.5/psycopg/sqlstate_errors.h Examining data/psycopg2-2.8.5/psycopg/pgtypes.h Examining data/psycopg2-2.8.5/psycopg/adapter_pint.c Examining data/psycopg2-2.8.5/psycopg/adapter_datetime.c Examining data/psycopg2-2.8.5/psycopg/connection.h Examining data/psycopg2-2.8.5/psycopg/adapter_pfloat.c Examining data/psycopg2-2.8.5/psycopg/win32_support.c Examining data/psycopg2-2.8.5/psycopg/lobject_int.c Examining data/psycopg2-2.8.5/psycopg/xid_type.c Examining data/psycopg2-2.8.5/psycopg/pqpath.h Examining data/psycopg2-2.8.5/psycopg/replication_message.h Examining data/psycopg2-2.8.5/psycopg/cursor.h Examining data/psycopg2-2.8.5/psycopg/replication_connection_type.c Examining data/psycopg2-2.8.5/psycopg/lobject.h Examining data/psycopg2-2.8.5/psycopg/solaris_support.c Examining data/psycopg2-2.8.5/psycopg/typecast_basic.c Examining data/psycopg2-2.8.5/psycopg/green.h Examining data/psycopg2-2.8.5/psycopg/adapter_asis.h Examining data/psycopg2-2.8.5/psycopg/connection_type.c Examining data/psycopg2-2.8.5/psycopg/conninfo_type.c Examining data/psycopg2-2.8.5/psycopg/win32_support.h Examining data/psycopg2-2.8.5/psycopg/lobject_type.c Examining data/psycopg2-2.8.5/psycopg/column.h Examining data/psycopg2-2.8.5/psycopg/adapter_list.h Examining data/psycopg2-2.8.5/psycopg/typecast_array.c FINAL RESULTS: data/psycopg2-2.8.5/psycopg/config.h:77:5: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, ap); data/psycopg2-2.8.5/psycopg/cursor_type.c:1082:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(sql, "SELECT * FROM %s(", procname); data/psycopg2-2.8.5/psycopg/cursor_type.c:1084:13: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(sql, scpnames[i]); data/psycopg2-2.8.5/psycopg/cursor_type.c:1104:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(sql, "SELECT * FROM %s(", procname); data/psycopg2-2.8.5/psycopg/pqpath.c:364:9: [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. snprintf(buf, bufsize, data/psycopg2-2.8.5/psycopg/psycopgmodule.c:790:5: [4] (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). strcpy(namebuf, prefix); data/psycopg2-2.8.5/psycopg/utils.c:154:5: [4] (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). strcpy(*to, from); data/psycopg2-2.8.5/psycopg/psycopgmodule.c:1075:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("PSYCOPG_DEBUG")) data/psycopg2-2.8.5/psycopg/adapter_datetime.c:100: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 buffer[8]; data/psycopg2-2.8.5/psycopg/adapter_list.c:115:9: [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. strcpy(ptr, "ARRAY["); data/psycopg2-2.8.5/psycopg/adapter_list.c:120: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(ptr, Bytes_AS_STRING(qs[i]), sl); data/psycopg2-2.8.5/psycopg/adapter_list.c:138:17: [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(ptr, s, sl); data/psycopg2-2.8.5/psycopg/adapter_list.c:142:17: [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(ptr, s + 1, sl - 2); data/psycopg2-2.8.5/psycopg/adapter_mxdatetime.c:58: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 buf[128] = { 0, }; data/psycopg2-2.8.5/psycopg/config.h:137:36: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define gmtime_r(t, tm) (gmtime(t)?memcpy((tm), gmtime(t), sizeof(*(tm))):NULL) data/psycopg2-2.8.5/psycopg/config.h:138:42: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define localtime_r(t, tm) (localtime(t)?memcpy((tm), localtime(t), sizeof(*(tm))):NULL) data/psycopg2-2.8.5/psycopg/connection_type.c:1142: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 errbuf[256]; data/psycopg2-2.8.5/psycopg/cursor_type.c:63: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. char buffer[256]; data/psycopg2-2.8.5/psycopg/cursor_type.c:757: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. char buffer[128]; data/psycopg2-2.8.5/psycopg/cursor_type.c:809: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. char buffer[128]; data/psycopg2-2.8.5/psycopg/cursor_type.c:875: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. char buffer[128]; data/psycopg2-2.8.5/psycopg/cursor_type.c:951: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. char buffer[128]; data/psycopg2-2.8.5/psycopg/cursor_type.c:1085:13: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(sql, ":=%s,"); data/psycopg2-2.8.5/psycopg/cursor_type.c:1106:13: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(sql, "%s,"); data/psycopg2-2.8.5/psycopg/cursor_type.c:1246: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. char buffer[128]; data/psycopg2-2.8.5/psycopg/libpq_support.c:77: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(&buf[0], &n32, 4); data/psycopg2-2.8.5/psycopg/libpq_support.c:82: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(&buf[4], &n32, 4); data/psycopg2-2.8.5/psycopg/libpq_support.c:95: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(&h32, buf, 4); data/psycopg2-2.8.5/psycopg/libpq_support.c:96: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(&l32, buf + 4, 4); data/psycopg2-2.8.5/psycopg/microprotocols.c:141: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 buffer[256]; data/psycopg2-2.8.5/psycopg/pqpath.c:347: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 buf[256]; /* buf size must be same as bufsize */ data/psycopg2-2.8.5/psycopg/pqpath.c:361:9: [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. strcpy(buf, "BEGIN"); data/psycopg2-2.8.5/psycopg/pqpath.c:561: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 query[256]; data/psycopg2-2.8.5/psycopg/pqpath.c:616: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 query[256]; data/psycopg2-2.8.5/psycopg/pqpath.c:1194:26: [2] (integer) atol: 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). curs->rowcount = atol(rowcount); data/psycopg2-2.8.5/psycopg/pqpath.c:1296: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. char buf[1024]; data/psycopg2-2.8.5/psycopg/pqpath.c:1297:9: [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. strcpy(buf, "error in .read() call"); data/psycopg2-2.8.5/psycopg/pqpath.c:1618: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 replybuf[1 + 8 + 8 + 8 + 8 + 1]; data/psycopg2-2.8.5/psycopg/psycopgmodule.c:762: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 namebuf[120]; data/psycopg2-2.8.5/psycopg/typecast_basic.c:33: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 buffer[12]; data/psycopg2-2.8.5/psycopg/typecast_basic.c:51: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 buffer[24]; data/psycopg2-2.8.5/psycopg/typecast_binary.c:202: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. static const char hex_lut[128] = { data/psycopg2-2.8.5/psycopg/connection_int.c:125:26: [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 (len < 0) { len = strlen(str); } data/psycopg2-2.8.5/psycopg/connection_int.c:388: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). if (!(j = buf = PyMem_Malloc(strlen(enc) + 1))) { data/psycopg2-2.8.5/psycopg/cursor_type.c:1074: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). sl += strlen(scpnames[i]); data/psycopg2-2.8.5/psycopg/cursor_type.c:1352:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&columnlist[offset], colname, collen); data/psycopg2-2.8.5/psycopg/cursor_type.c:1437:18: [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). query_size = strlen(command) + strlen(table_name) + strlen(columnlist) data/psycopg2-2.8.5/psycopg/cursor_type.c:1437:36: [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). query_size = strlen(command) + strlen(table_name) + strlen(columnlist) data/psycopg2-2.8.5/psycopg/cursor_type.c:1437:57: [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). query_size = strlen(command) + strlen(table_name) + strlen(columnlist) data/psycopg2-2.8.5/psycopg/cursor_type.c:1438: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). + strlen(quoted_delimiter) + strlen(quoted_null) + 1; data/psycopg2-2.8.5/psycopg/cursor_type.c:1438: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). + strlen(quoted_delimiter) + strlen(quoted_null) + 1; data/psycopg2-2.8.5/psycopg/cursor_type.c:1529:18: [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). query_size = strlen(command) + strlen(table_name) + strlen(columnlist) data/psycopg2-2.8.5/psycopg/cursor_type.c:1529:36: [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). query_size = strlen(command) + strlen(table_name) + strlen(columnlist) data/psycopg2-2.8.5/psycopg/cursor_type.c:1529:57: [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). query_size = strlen(command) + strlen(table_name) + strlen(columnlist) data/psycopg2-2.8.5/psycopg/cursor_type.c:1530: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). + strlen(quoted_delimiter) + strlen(quoted_null) + 1; data/psycopg2-2.8.5/psycopg/cursor_type.c:1530: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). + strlen(quoted_delimiter) + strlen(quoted_null) + 1; data/psycopg2-2.8.5/psycopg/lobject_int.c:96: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). if (pos != strlen(mode)) { data/psycopg2-2.8.5/psycopg/pqpath.c:75:9: [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 (strlen(msg) > 8 && (!strncmp(msg, "ERROR: ", 8) || data/psycopg2-2.8.5/psycopg/pqpath.c:667:18: [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). buflen = 2 + strlen(cmd) + strlen(etid); /* add space, zero */ data/psycopg2-2.8.5/psycopg/pqpath.c:667:32: [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). buflen = 2 + strlen(cmd) + strlen(etid); /* add space, zero */ data/psycopg2-2.8.5/psycopg/psycopgmodule.c:800:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(suffix, sqlstate_table[i].name, bufsize); data/psycopg2-2.8.5/psycopg/typecast_basic.c:37:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, s, (size_t) len); buffer[len] = '\0'; data/psycopg2-2.8.5/psycopg/typecast_basic.c:55:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, s, (size_t) len); buffer[len] = '\0'; data/psycopg2-2.8.5/psycopg/typecast_basic.c:155:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, s, (size_t) len); buffer[len] = '\0'; data/psycopg2-2.8.5/psycopg/utils.c:59:15: [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(from); data/psycopg2-2.8.5/psycopg/utils.c:115:26: [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 (len < 0) { len = strlen(str); } data/psycopg2-2.8.5/psycopg/utils.c:149:26: [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 (len < 0) { len = strlen(from); } data/psycopg2-2.8.5/psycopg/utils.c:324:26: [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 (len < 0) { len = strlen(str); } data/psycopg2-2.8.5/psycopg/utils.c:337:26: [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 (len < 0) { len = strlen(str); } data/psycopg2-2.8.5/psycopg/xid_type.c:107:17: [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). gtrid_len = strlen(gtrid); data/psycopg2-2.8.5/psycopg/xid_type.c:121:17: [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). bqual_len = strlen(bqual); ANALYSIS SUMMARY: Hits = 71 Lines analyzed = 22447 in approximately 0.62 seconds (36090 lines/second) Physical Source Lines of Code (SLOC) = 15082 Hits@level = [0] 3 [1] 29 [2] 34 [3] 1 [4] 7 [5] 0 Hits@level+ = [0+] 74 [1+] 71 [2+] 42 [3+] 8 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 4.90651 [1+] 4.7076 [2+] 2.78478 [3+] 0.530434 [4+] 0.464129 [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.