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/lua-dbi-0.7.2/dbd/common.c Examining data/lua-dbi-0.7.2/dbd/common.h Examining data/lua-dbi-0.7.2/dbd/db2/connection.c Examining data/lua-dbi-0.7.2/dbd/db2/db2_common.c Examining data/lua-dbi-0.7.2/dbd/db2/db2_common.h Examining data/lua-dbi-0.7.2/dbd/db2/dbd_db2.h Examining data/lua-dbi-0.7.2/dbd/db2/main.c Examining data/lua-dbi-0.7.2/dbd/db2/statement.c Examining data/lua-dbi-0.7.2/dbd/mysql/connection.c Examining data/lua-dbi-0.7.2/dbd/mysql/dbd_mysql.h Examining data/lua-dbi-0.7.2/dbd/mysql/main.c Examining data/lua-dbi-0.7.2/dbd/mysql/statement.c Examining data/lua-dbi-0.7.2/dbd/oracle/connection.c Examining data/lua-dbi-0.7.2/dbd/oracle/dbd_oracle.h Examining data/lua-dbi-0.7.2/dbd/oracle/main.c Examining data/lua-dbi-0.7.2/dbd/oracle/statement.c Examining data/lua-dbi-0.7.2/dbd/postgresql/connection.c Examining data/lua-dbi-0.7.2/dbd/postgresql/dbd_postgresql.h Examining data/lua-dbi-0.7.2/dbd/postgresql/main.c Examining data/lua-dbi-0.7.2/dbd/postgresql/statement.c Examining data/lua-dbi-0.7.2/dbd/sqlite3/connection.c Examining data/lua-dbi-0.7.2/dbd/sqlite3/dbd_sqlite3.h Examining data/lua-dbi-0.7.2/dbd/sqlite3/main.c Examining data/lua-dbi-0.7.2/dbd/sqlite3/statement.c FINAL RESULTS: data/lua-dbi-0.7.2/dbd/common.c:86:10: [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. n = snprintf(&newsql[newpos], MAX_PLACEHOLDER_SIZE, format_str, ph_num++); data/lua-dbi-0.7.2/dbd/common.h:20:14: [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. #define snprintf _snprintf data/lua-dbi-0.7.2/dbd/common.h:20:23: [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. #define snprintf _snprintf data/lua-dbi-0.7.2/dbd/db2/statement.c:184:13: [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(err, sizeof(err)-1, DBI_ERR_BINDING_TYPE_ERR, lua_typename(L, type)); data/lua-dbi-0.7.2/dbd/mysql/statement.c:262:3: [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(err, sizeof(err)-1, DBI_ERR_BINDING_TYPE_ERR, lua_typename(L, type)); data/lua-dbi-0.7.2/dbd/oracle/statement.c:345:13: [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(err, sizeof(err)-1, DBI_ERR_BINDING_TYPE_ERR, lua_typename(L, type)); data/lua-dbi-0.7.2/dbd/postgresql/statement.c:184:13: [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(err, sizeof(err)-1, DBI_ERR_BINDING_TYPE_ERR, lua_typename(L, type)); data/lua-dbi-0.7.2/dbd/sqlite3/statement.c:188:13: [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(err, sizeof(err)-1, DBI_ERR_BINDING_TYPE_ERR, lua_typename(L, type)); data/lua-dbi-0.7.2/dbd/common.c:27: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 format_str[4]; data/lua-dbi-0.7.2/dbd/db2/statement.c:148: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 err[64]; data/lua-dbi-0.7.2/dbd/mysql/statement.c:216: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 err[64]; data/lua-dbi-0.7.2/dbd/mysql/statement.c:392:41: [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. LUA_PUSH_ATTRIB_INT(name, (int)*(char *)(bind[i].buffer)); data/lua-dbi-0.7.2/dbd/mysql/statement.c:394:37: [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. LUA_PUSH_ARRAY_INT(d, (int)*(char *)(bind[i].buffer)); data/lua-dbi-0.7.2/dbd/mysql/statement.c:426:4: [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 str[20]; data/lua-dbi-0.7.2/dbd/mysql/statement.c:437:4: [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 str[9]; data/lua-dbi-0.7.2/dbd/mysql/statement.c:448:4: [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 str[20]; data/lua-dbi-0.7.2/dbd/oracle/connection.c:90: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 errbuf[100]; data/lua-dbi-0.7.2/dbd/oracle/connection.c:98:5: [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(errbuf, "OCI_NEED_DATA"); data/lua-dbi-0.7.2/dbd/oracle/connection.c:101:7: [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(errbuf, "OCI_NO_DATA"); data/lua-dbi-0.7.2/dbd/oracle/connection.c:108:7: [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(errbuf, "OCI_INVALID_HANDLE"); data/lua-dbi-0.7.2/dbd/oracle/connection.c:111:7: [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(errbuf, "OCI_STILL_EXECUTE"); data/lua-dbi-0.7.2/dbd/oracle/connection.c:114:7: [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(errbuf, "OCI_CONTINUE"); data/lua-dbi-0.7.2/dbd/oracle/connection.c:117:7: [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(errbuf, "Unknown OCI error"); data/lua-dbi-0.7.2/dbd/oracle/connection.c:202: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. char errbuf[100]; data/lua-dbi-0.7.2/dbd/oracle/statement.c:45: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[100]; data/lua-dbi-0.7.2/dbd/oracle/statement.c:284: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[100]; data/lua-dbi-0.7.2/dbd/oracle/statement.c:297: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 err[64]; data/lua-dbi-0.7.2/dbd/oracle/statement.c:444: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[100]; data/lua-dbi-0.7.2/dbd/oracle/statement.c:473:39: [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 *name = dbd_strlower((char *)bind[i].name); data/lua-dbi-0.7.2/dbd/oracle/statement.c:497: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). int val = atoi(data); data/lua-dbi-0.7.2/dbd/oracle/statement.c:519: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). int val = atoi(data); data/lua-dbi-0.7.2/dbd/postgresql/connection.c:52: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 portbuf[18]; data/lua-dbi-0.7.2/dbd/postgresql/dbd_postgresql.h:28: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 name[IDLEN]; /* statement ID */ data/lua-dbi-0.7.2/dbd/postgresql/statement.c:39: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 command[IDLEN+13]; data/lua-dbi-0.7.2/dbd/postgresql/statement.c:76:24: [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). lua_pushinteger(L, atoi(PQcmdTuples(statement->result))); data/lua-dbi-0.7.2/dbd/postgresql/statement.c:163: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 err[64]; data/lua-dbi-0.7.2/dbd/postgresql/statement.c:284: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). int val = atoi(value); data/lua-dbi-0.7.2/dbd/postgresql/statement.c:401: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 name[IDLEN]; data/lua-dbi-0.7.2/dbd/sqlite3/statement.c:165: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 err[64]; data/lua-dbi-0.7.2/dbd/common.c:19: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). size_t len = strlen(sql); data/lua-dbi-0.7.2/dbd/mysql/statement.c:571:29: [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). unsigned long sql_len = strlen(sql_query); data/lua-dbi-0.7.2/dbd/oracle/connection.c:188:80: [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). rc = OCIAttrSet((dvoid *)sess, (ub4)OCI_HTYPE_SESSION, (dvoid *)user, (ub4)strlen(user), (ub4) OCI_ATTR_USERNAME, err); data/lua-dbi-0.7.2/dbd/oracle/connection.c:191:84: [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). rc = OCIAttrSet((dvoid *)sess, (ub4)OCI_HTYPE_SESSION, (dvoid *)password, (ub4)strlen(password), (ub4) OCI_ATTR_PASSWORD, err); data/lua-dbi-0.7.2/dbd/oracle/connection.c:194:84: [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). rc = OCIServerAttach((OCIServer *)svr, (OCIError *)err, (CONST text *)db, (sb4)strlen(db), (ub4)0); data/lua-dbi-0.7.2/dbd/oracle/statement.c:619:65: [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). OCIStmtPrepare(stmt, conn->err, (CONST text *)new_sql, (ub4)strlen(new_sql), (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT); data/lua-dbi-0.7.2/dbd/postgresql/statement.c:439:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(statement->name, name, IDLEN-1); data/lua-dbi-0.7.2/dbd/sqlite3/statement.c:384:64: [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 (sqlite3_prepare_v2(statement->conn->sqlite, sql_query, strlen(sql_query), &statement->stmt, NULL) != SQLITE_OK) { ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 5052 in approximately 0.12 seconds (41116 lines/second) Physical Source Lines of Code (SLOC) = 3376 Hits@level = [0] 6 [1] 8 [2] 31 [3] 0 [4] 8 [5] 0 Hits@level+ = [0+] 53 [1+] 47 [2+] 39 [3+] 8 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 15.6991 [1+] 13.9218 [2+] 11.5521 [3+] 2.36967 [4+] 2.36967 [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.