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-systemd-0~git20160517/src/daemon.c Examining data/lua-systemd-0~git20160517/src/id128.c Examining data/lua-systemd-0~git20160517/src/id128.h Examining data/lua-systemd-0~git20160517/src/journal.c Examining data/lua-systemd-0~git20160517/src/journal.h Examining data/lua-systemd-0~git20160517/src/login.c Examining data/lua-systemd-0~git20160517/src/login.h Examining data/lua-systemd-0~git20160517/src/messages.c Examining data/lua-systemd-0~git20160517/src/messages.h Examining data/lua-systemd-0~git20160517/src/util.c Examining data/lua-systemd-0~git20160517/vendor/compat-5.3/c-api/compat-5.3.c Examining data/lua-systemd-0~git20160517/vendor/compat-5.3/c-api/compat-5.3.h Examining data/lua-systemd-0~git20160517/vendor/compat-5.3/lprefix.h Examining data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c Examining data/lua-systemd-0~git20160517/vendor/compat-5.3/ltablib.c Examining data/lua-systemd-0~git20160517/vendor/compat-5.3/lutf8lib.c Examining data/lua-systemd-0~git20160517/vendor/compat-5.3/tests/testmod.c FINAL RESULTS: data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:866:3: [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(form + l - 1, lenmod); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:894:16: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. nb = sprintf(buff, form, (int)luaL_checkinteger(L, arg)); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:901:16: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. nb = sprintf(buff, form, n); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:910:16: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. nb = sprintf(buff, form, luaL_checknumber(L, arg)); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:927:18: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. nb = sprintf(buff, form, s); data/lua-systemd-0~git20160517/src/id128.c:56: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 s[33]; data/lua-systemd-0~git20160517/vendor/compat-5.3/c-api/compat-5.3.c:394: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(newptr, B->ptr, B->nelems); data/lua-systemd-0~git20160517/vendor/compat-5.3/c-api/compat-5.3.c:405: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(luaL_prepbuffsize(B, l), s, l); data/lua-systemd-0~git20160517/vendor/compat-5.3/lprefix.h:67: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 buff[8] = { 0 }; data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:130: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(p, s, l * sizeof(char)); p += l; data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:132: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(p, sep, lsep * sizeof(char)); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:136: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(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:823: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 buff[10]; data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:825:9: [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(buff, "\\%d", (int)uchar(*s)); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:827:9: [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(buff, "\\%03d", (int)uchar(*s)); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:852: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(form, strfrmt, (p - strfrmt + 1) * sizeof(char)); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:886: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 form[MAX_FORMAT]; /* to store the format ('%...') */ data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:995: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 buff[5 * sizeof(lua_Number)]; /* enough for any float type */ data/lua-systemd-0~git20160517/src/id128.c:47:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. static int equal (lua_State *L) { data/lua-systemd-0~git20160517/src/id128.c:73:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. {"__eq", equal}, data/lua-systemd-0~git20160517/vendor/compat-5.3/c-api/compat-5.3.h:207:25: [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_addlstring(B, s, strlen(s)) data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:580:13: [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). upto += strlen(p + upto) + 1; /* may have more after \0 */ data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:863:14: [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 l = strlen(form); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:864: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). size_t lm = strlen(lenmod); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:1246: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). luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); data/lua-systemd-0~git20160517/vendor/compat-5.3/lstrlib.c:1370:27: [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 = (int)strlen(data + pos); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 4986 in approximately 0.16 seconds (31885 lines/second) Physical Source Lines of Code (SLOC) = 4022 Hits@level = [0] 0 [1] 8 [2] 13 [3] 0 [4] 5 [5] 0 Hits@level+ = [0+] 26 [1+] 26 [2+] 18 [3+] 5 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 6.46445 [1+] 6.46445 [2+] 4.47539 [3+] 1.24316 [4+] 1.24316 [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.