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-pllua-2.0.6/hstore/hstore_pllua.c Examining data/postgresql-pllua-2.0.6/hstore/old_inc/hstore/hstore.h Examining data/postgresql-pllua-2.0.6/src/compile.c Examining data/postgresql-pllua-2.0.6/src/datum.c Examining data/postgresql-pllua-2.0.6/src/elog.c Examining data/postgresql-pllua-2.0.6/src/error.c Examining data/postgresql-pllua-2.0.6/src/exec.c Examining data/postgresql-pllua-2.0.6/src/globals.c Examining data/postgresql-pllua-2.0.6/src/init.c Examining data/postgresql-pllua-2.0.6/src/jsonb.c Examining data/postgresql-pllua-2.0.6/src/numeric.c Examining data/postgresql-pllua-2.0.6/src/objects.c Examining data/postgresql-pllua-2.0.6/src/paths.c Examining data/postgresql-pllua-2.0.6/src/plerrcodes_old.h Examining data/postgresql-pllua-2.0.6/src/pllua.c Examining data/postgresql-pllua-2.0.6/src/pllua.h Examining data/postgresql-pllua-2.0.6/src/pllua_luajit.h Examining data/postgresql-pllua-2.0.6/src/pllua_luaver.h Examining data/postgresql-pllua-2.0.6/src/pllua_pgver.h Examining data/postgresql-pllua-2.0.6/src/preload.c Examining data/postgresql-pllua-2.0.6/src/spi.c Examining data/postgresql-pllua-2.0.6/src/time.c Examining data/postgresql-pllua-2.0.6/src/trigger.c Examining data/postgresql-pllua-2.0.6/src/trusted.c FINAL RESULTS: data/postgresql-pllua-2.0.6/src/datum.c:622: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(str, 32, UINT64_FORMAT, uval); data/postgresql-pllua-2.0.6/src/elog.c:61:2: [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. vsnprintf(buf, LUAL_BUFFERSIZE, msg, va); data/postgresql-pllua-2.0.6/src/elog.c:80:2: [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. vsnprintf(buf, LUAL_BUFFERSIZE, msg, va); data/postgresql-pllua-2.0.6/hstore/old_inc/hstore/hstore.h:101: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((dptr_), (sptr_), (klen_)+(vlen_)); \ data/postgresql-pllua-2.0.6/hstore/old_inc/hstore/hstore.h:114: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((dptr_), (pair_).key, (pair_).keylen); \ data/postgresql-pllua-2.0.6/hstore/old_inc/hstore/hstore.h:122: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((dptr_), (pair_).val, (pair_).vallen); \ data/postgresql-pllua-2.0.6/src/compile.c:317: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(act->argtypes, data/postgresql-pllua-2.0.6/src/compile.c:375: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(func_info->argtypes, data/postgresql-pllua-2.0.6/src/datum.c:405:9: [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(VARDATA(t), str, len); data/postgresql-pllua-2.0.6/src/datum.c:415:8: [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(VARDATA(b), str, len); data/postgresql-pllua-2.0.6/src/datum.c:527:6: [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(VARDATA(t), str, len); data/postgresql-pllua-2.0.6/src/datum.c:621: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 str[32]; data/postgresql-pllua-2.0.6/src/datum.c:5215: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 droplist[MaxTupleAttributeNumber + 1]; data/postgresql-pllua-2.0.6/src/error.c:1104: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 buf[8]; data/postgresql-pllua-2.0.6/src/error.c:1114: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 buf[8]; data/postgresql-pllua-2.0.6/src/error.c:1235: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 buf[8]; data/postgresql-pllua-2.0.6/src/error.c:1347: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[8]; data/postgresql-pllua-2.0.6/src/jsonb.c:278: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(newstr, ptr, len); data/postgresql-pllua-2.0.6/src/jsonb.c:491:7: [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(curval.val.string.val, ptr, len); data/postgresql-pllua-2.0.6/src/paths.c:13: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 path[MAXPGPATH]; data/postgresql-pllua-2.0.6/src/spi.c:289: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(stmt->param_types, argtypes, nargs_known * sizeof(Oid)); data/postgresql-pllua-2.0.6/src/time.c:601: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 strbuf[32]; data/postgresql-pllua-2.0.6/src/time.c:604:7: [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(strbuf, "00:00:00%c%02d:%02d:%02d", data/postgresql-pllua-2.0.6/src/time.c:697: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 strbuf[32]; data/postgresql-pllua-2.0.6/src/time.c:699:7: [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(strbuf, "%02d:%02d:%02d%c%02d:%02d:%02d", data/postgresql-pllua-2.0.6/src/compile.c:73:31: [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 (luaL_loadbufferx(L, str, strlen(str), "DO-block", "t")) data/postgresql-pllua-2.0.6/src/compile.c:188:31: [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 (luaL_loadbufferx(L, src, strlen(src), fname, "t")) data/postgresql-pllua-2.0.6/src/datum.c:122: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 (str && !pg_verifymbstr(str, strlen(str), true)) data/postgresql-pllua-2.0.6/src/datum.c:135: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). return pg_verifymbstr(str, strlen(str), true); data/postgresql-pllua-2.0.6/src/datum.c:279: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). lua_pushlstring(L, str, strlen(str)); data/postgresql-pllua-2.0.6/src/datum.c:398: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). if (len != strlen(str)) data/postgresql-pllua-2.0.6/src/datum.c:423: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). if (len != strlen(str)) data/postgresql-pllua-2.0.6/src/datum.c:3242: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). luaL_addsize(&b, strlen(buf)); data/postgresql-pllua-2.0.6/src/elog.c:63: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). luaL_addsize(&b, strlen(buf)); data/postgresql-pllua-2.0.6/src/elog.c:82: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). luaL_addsize(&b, strlen(buf)); data/postgresql-pllua-2.0.6/src/elog.c:239:6: [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(str) == 5 data/postgresql-pllua-2.0.6/src/error.c:1335: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(str) == 5 data/postgresql-pllua-2.0.6/src/init.c:588:37: [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). int rc = luaL_loadbufferx(L, str, strlen(str), chunkname, "t"); data/postgresql-pllua-2.0.6/src/objects.c:602: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). luaL_addsize(&b, strlen(buf)); data/postgresql-pllua-2.0.6/src/objects.c:610: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). luaL_addsize(&b, strlen(buf)); data/postgresql-pllua-2.0.6/src/trusted.c:823: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). if (luaL_loadbuffer(L, trusted_lua, strlen(trusted_lua), "trusted.lua") == LUA_OK) ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 19503 in approximately 0.43 seconds (45814 lines/second) Physical Source Lines of Code (SLOC) = 13864 Hits@level = [0] 3 [1] 16 [2] 22 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 44 [1+] 41 [2+] 25 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 3.17369 [1+] 2.9573 [2+] 1.80323 [3+] 0.216388 [4+] 0.216388 [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.