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-filesystem-1.8.0/src/lfs.c Examining data/lua-filesystem-1.8.0/src/lfs.h FINAL RESULTS: data/lua-filesystem-1.8.0/src/lfs.c:1089:13: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. tsize = readlink(file, target, size); data/lua-filesystem-1.8.0/src/lfs.c:430: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(ln, path); data/lua-filesystem-1.8.0/src/lfs.c:431:3: [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(ln, lockfile); data/lua-filesystem-1.8.0/src/lfs.c:472: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(ln, path); data/lua-filesystem-1.8.0/src/lfs.c:473:3: [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(ln, lockfile); data/lua-filesystem-1.8.0/src/lfs.c:722:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(d->pattern, "%s/*", path); data/lua-filesystem-1.8.0/src/lfs.c:117: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 pattern[MAX_PATH + 1]; data/lua-filesystem-1.8.0/src/lfs.c:924:10: [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 char perms[10] = "---------"; data/lua-filesystem-1.8.0/src/lfs.c:948:10: [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 char perms[10] = "---------"; data/lua-filesystem-1.8.0/src/lfs.c:424: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). ln = (char *) malloc(pathl + strlen(lockfile) + 1); data/lua-filesystem-1.8.0/src/lfs.c:466: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). ln = (char *) malloc(pathl + strlen(lockfile) + 1); data/lua-filesystem-1.8.0/src/lfs.c:719:7: [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(path) > MAX_PATH - 2) ANALYSIS SUMMARY: Hits = 12 Lines analyzed = 1217 in approximately 0.04 seconds (34247 lines/second) Physical Source Lines of Code (SLOC) = 934 Hits@level = [0] 0 [1] 3 [2] 3 [3] 0 [4] 5 [5] 1 Hits@level+ = [0+] 12 [1+] 12 [2+] 9 [3+] 6 [4+] 6 [5+] 1 Hits/KSLOC@level+ = [0+] 12.848 [1+] 12.848 [2+] 9.63597 [3+] 6.42398 [4+] 6.42398 [5+] 1.07066 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.