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-wsapi-1.6.1/src/fastcgi/lfcgi.c Examining data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.h Examining data/lua-wsapi-1.6.1/src/launcher/launcher.c Examining data/lua-wsapi-1.6.1/src/launcher/wsapi.c FINAL RESULTS: data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:226:9: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. *pf = popen(filename, mode); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:476:11: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:599:30: [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. char *val = getenv(envVar); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:198: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[128]; data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:201: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(buff, "closed"); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:203:5: [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, "%p", lua_touserdata(L, 1)); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:213:9: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). *pf = fopen(filename, mode); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:234:9: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). *pf = tmpfile(); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:252:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). *pf = fopen(filename, mode); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:309:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). *pf = fopen(filename, "r"); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:327: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[32], ch; data/lua-wsapi-1.6.1/src/launcher/launcher.c:68: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 name[ MAX_PATH ]; data/lua-wsapi-1.6.1/src/launcher/launcher.c:77:3: [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(name, ".cgi"); data/lua-wsapi-1.6.1/src/launcher/wsapi.c:69: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 name[ MAX_PATH ]; data/lua-wsapi-1.6.1/src/launcher/wsapi.c:72:2: [2] (buffer) TCHAR: 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. TCHAR lua_string[10000]; data/lua-wsapi-1.6.1/src/launcher/wsapi.c:78:4: [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(name, ".lua"); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:330:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc (f); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:348:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(f); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:365: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). l = strlen(p); data/lua-wsapi-1.6.1/src/fastcgi/lfcgi.c:539:8: [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(name); ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 895 in approximately 0.08 seconds (11567 lines/second) Physical Source Lines of Code (SLOC) = 656 Hits@level = [0] 9 [1] 4 [2] 13 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 29 [1+] 20 [2+] 16 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 44.2073 [1+] 30.4878 [2+] 24.3902 [3+] 4.57317 [4+] 3.04878 [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.