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/lua50-5.0.3/etc/min.c Examining data/lua50-5.0.3/etc/trace.c Examining data/lua50-5.0.3/etc/bin2c.c Examining data/lua50-5.0.3/etc/luser_tests.h Examining data/lua50-5.0.3/etc/saconfig.c Examining data/lua50-5.0.3/etc/noparser.c Examining data/lua50-5.0.3/etc/luser_number.h Examining data/lua50-5.0.3/include/lua.h Examining data/lua50-5.0.3/include/lualib.h Examining data/lua50-5.0.3/include/lauxlib.h Examining data/lua50-5.0.3/src/luac/luac.c Examining data/lua50-5.0.3/src/luac/print.c Examining data/lua50-5.0.3/src/lib/lauxlib.c Examining data/lua50-5.0.3/src/lib/lbaselib.c Examining data/lua50-5.0.3/src/lib/ldblib.c Examining data/lua50-5.0.3/src/lib/liolib.c Examining data/lua50-5.0.3/src/lib/lmathlib.c Examining data/lua50-5.0.3/src/lib/ltablib.c Examining data/lua50-5.0.3/src/lib/lstrlib.c Examining data/lua50-5.0.3/src/lib/loadlib.c Examining data/lua50-5.0.3/src/lib/compat-5.1r5/compat-5.1.c Examining data/lua50-5.0.3/src/lib/compat-5.1r5/compat-5.1.h Examining data/lua50-5.0.3/src/lua/lua.c Examining data/lua50-5.0.3/src/lapi.c Examining data/lua50-5.0.3/src/lcode.c Examining data/lua50-5.0.3/src/ldebug.c Examining data/lua50-5.0.3/src/ldo.c Examining data/lua50-5.0.3/src/ldump.c Examining data/lua50-5.0.3/src/lfunc.c Examining data/lua50-5.0.3/src/lgc.c Examining data/lua50-5.0.3/src/llex.c Examining data/lua50-5.0.3/src/lmem.c Examining data/lua50-5.0.3/src/lobject.c Examining data/lua50-5.0.3/src/lopcodes.c Examining data/lua50-5.0.3/src/lparser.c Examining data/lua50-5.0.3/src/lstate.c Examining data/lua50-5.0.3/src/lstring.c Examining data/lua50-5.0.3/src/ltable.c Examining data/lua50-5.0.3/src/ltests.c Examining data/lua50-5.0.3/src/ltm.c Examining data/lua50-5.0.3/src/lundump.c Examining data/lua50-5.0.3/src/lvm.c Examining data/lua50-5.0.3/src/lzio.c Examining data/lua50-5.0.3/src/lapi.h Examining data/lua50-5.0.3/src/lcode.h Examining data/lua50-5.0.3/src/ldebug.h Examining data/lua50-5.0.3/src/ldo.h Examining data/lua50-5.0.3/src/lfunc.h Examining data/lua50-5.0.3/src/lgc.h Examining data/lua50-5.0.3/src/llex.h Examining data/lua50-5.0.3/src/llimits.h Examining data/lua50-5.0.3/src/lmem.h Examining data/lua50-5.0.3/src/lobject.h Examining data/lua50-5.0.3/src/lopcodes.h Examining data/lua50-5.0.3/src/lparser.h Examining data/lua50-5.0.3/src/lstate.h Examining data/lua50-5.0.3/src/lstring.h Examining data/lua50-5.0.3/src/ltable.h Examining data/lua50-5.0.3/src/ltm.h Examining data/lua50-5.0.3/src/lundump.h Examining data/lua50-5.0.3/src/lvm.h Examining data/lua50-5.0.3/src/lzio.h FINAL RESULTS: data/lua50-5.0.3/src/lib/liolib.c:217:11: [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. fh->f = popen(filename, mode); data/lua50-5.0.3/src/lib/liolib.c:318:7: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { data/lua50-5.0.3/src/lib/liolib.c:455: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/lua50-5.0.3/src/lib/liolib.c:552:21: [4] (shell) system: 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. lua_pushnumber(L, system(luaL_checkstring(L, 1))); data/lua50-5.0.3/src/lib/lstrlib.c:703:11: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buff, form, luaL_checkint(L, arg)); data/lua50-5.0.3/src/lib/lstrlib.c:707:11: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buff, form, (unsigned int)(luaL_checknumber(L, arg))); data/lua50-5.0.3/src/lib/lstrlib.c:712:11: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buff, form, luaL_checknumber(L, arg)); data/lua50-5.0.3/src/lib/lstrlib.c:730:13: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buff, form, s); data/lua50-5.0.3/src/lobject.c:179:7: [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(out, source); data/lua50-5.0.3/src/lobject.c:191:9: [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(out, source); data/lua50-5.0.3/src/ltests.c:165:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buff+strlen(buff), "%-12s%4d %4d %4d", name, data/lua50-5.0.3/src/ltests.c:169:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_Bx(i)); data/lua50-5.0.3/src/ltests.c:172:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_sBx(i)); data/lua50-5.0.3/src/luac/luac.c:55:36: [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(stderr,"%s: ",progname); fprintf(stderr,message,arg); fprintf(stderr,"\n"); data/lua50-5.0.3/src/luac/print.c:53:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(LUA_NUMBER_FMT,nvalue(o)); data/lua50-5.0.3/src/lvm.c:35:33: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) data/lua50-5.0.3/src/lib/lbaselib.c:424:10: [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. path = getenv(LUA_PATH); /* else try environment variable */ data/lua50-5.0.3/src/lib/liolib.c:576:7: [3] (tmpfile) tmpnam: Temporary file race condition (CWE-377). if (tmpnam(buff) != buff) data/lua50-5.0.3/src/lib/liolib.c:585:21: [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. lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ data/lua50-5.0.3/src/lib/lmathlib.c:199:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(luaL_checkint(L, 1)); data/lua50-5.0.3/src/lib/loadlib.c:110:16: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. HINSTANCE lib=LoadLibrary(path); data/lua50-5.0.3/src/ltests.c:845:17: [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 *limit = getenv("MEMLIMIT"); data/lua50-5.0.3/src/lua/lua.c:105:26: [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. const char* home = getenv("HOME"); data/lua50-5.0.3/src/lua/lua.c:136:26: [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. const char* home = getenv("HOME"); data/lua50-5.0.3/src/lua/lua.c:511:22: [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. const char *init = getenv("LUA_INIT"); data/lua50-5.0.3/etc/bin2c.c:27: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). FILE* f= fopen(fn,"rb"); /* must open in binary mode */ data/lua50-5.0.3/etc/min.c:33: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. static char buff[512]; data/lua50-5.0.3/include/lauxlib.h:99: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 buffer[LUAL_BUFFERSIZE]; data/lua50-5.0.3/include/lua.h:359: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 short_src[LUA_IDSIZE]; /* (S) */ data/lua50-5.0.3/src/ldebug.c:557: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[LUA_IDSIZE]; /* add file:line information */ data/lua50-5.0.3/src/lib/lauxlib.c:397: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(B->p, lua_tostring(L, -1), vl); /* put it there */ data/lua50-5.0.3/src/lib/lauxlib.c:465: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[LUAL_BUFFERSIZE]; data/lua50-5.0.3/src/lib/lauxlib.c:497:12: [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). lf.f = fopen(filename, "r"); data/lua50-5.0.3/src/lib/lauxlib.c:503:12: [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). lf.f = fopen(filename, "rb"); /* reopen in binary mode */ data/lua50-5.0.3/src/lib/lbaselib.c:330: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/lua50-5.0.3/src/lib/lbaselib.c:345: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(buff, "table: %p", lua_topointer(L, 1)); data/lua50-5.0.3/src/lib/lbaselib.c:348: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(buff, "function: %p", lua_topointer(L, 1)); data/lua50-5.0.3/src/lib/lbaselib.c:352: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(buff, "userdata: %p", lua_touserdata(L, 1)); data/lua50-5.0.3/src/lib/lbaselib.c:355: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(buff, "thread: %p", (void *)lua_tothread(L, 1)); data/lua50-5.0.3/src/lib/ldblib.c:196: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]; data/lua50-5.0.3/src/lib/ldblib.c:213: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 buffer[250]; data/lua50-5.0.3/src/lib/liolib.c:189: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/lua50-5.0.3/src/lib/liolib.c:192: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/lua50-5.0.3/src/lib/liolib.c:194: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/lua50-5.0.3/src/lib/liolib.c:204: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/lua50-5.0.3/src/lib/liolib.c:226:9: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). *pf = tmpfile(); data/lua50-5.0.3/src/lib/liolib.c:244: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/lua50-5.0.3/src/lib/liolib.c:301: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/lua50-5.0.3/src/lib/liolib.c:575: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[L_tmpnam]; data/lua50-5.0.3/src/lib/liolib.c:669: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 b[256]; data/lua50-5.0.3/src/lib/loadlib.c:98: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 buffer[128]; data/lua50-5.0.3/src/lib/lstrlib.c:694: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/lua50-5.0.3/src/lib/lstrlib.c:695: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[MAX_ITEM]; /* to store the formatted item */ data/lua50-5.0.3/src/llex.c:64: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[MAXSRC]; data/lua50-5.0.3/src/lobject.c:124: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 buff[2]; data/lua50-5.0.3/src/lobject.c:177:9: [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(out, "..."); data/lua50-5.0.3/src/lobject.c:185: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(out, "[string \""); data/lua50-5.0.3/src/lobject.c:188:9: [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(out, "..."); data/lua50-5.0.3/src/lobject.c:192:7: [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(out, "\"]"); data/lua50-5.0.3/src/lstring.c:59: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(ts+1, str, l*sizeof(char)); data/lua50-5.0.3/src/ltests.c:129: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(cast(char *, newblock)+HEADER, block, commonsize); data/lua50-5.0.3/src/ltests.c:162:3: [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, "(%4d) %4d - ", line, pc); data/lua50-5.0.3/src/ltests.c:183: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[100]; data/lua50-5.0.3/src/ltests.c:201: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[100]; data/lua50-5.0.3/src/ltests.c:585: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[30]; data/lua50-5.0.3/src/lua/lua.c:332: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 buffer[MAXINPUT]; data/lua50-5.0.3/src/luac/luac.c:182: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). FILE* D=fopen(output,"wb"); data/lua50-5.0.3/src/lvm.c:59: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 s[32]; /* 16 digits, sign, point and \0 (+ some extra...) */ data/lua50-5.0.3/src/lvm.c:337: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(buffer+tl, svalue(top-i), l); data/lua50-5.0.3/src/lzio.c:62: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(b, z->p, m); data/lua50-5.0.3/etc/bin2c.c:17:9: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c=getc(f); data/lua50-5.0.3/etc/saconfig.c:76: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 n=strlen(s)-1; data/lua50-5.0.3/src/lapi.c:418: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). lua_pushlstring(L, s, strlen(s)); data/lua50-5.0.3/src/lib/lauxlib.c:178: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). *len = (def ? strlen(def) : 0); data/lua50-5.0.3/src/lib/lauxlib.c:382: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/lua50-5.0.3/src/lib/lauxlib.c:500:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = ungetc(getc(lf.f), lf.f); data/lua50-5.0.3/src/lib/lauxlib.c:588: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). return lua_dobuffer(L, str, strlen(str), str); data/lua50-5.0.3/src/lib/lbaselib.c:435: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). if (l == NULL) l = path+strlen(path); data/lua50-5.0.3/src/lib/liolib.c:327:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(f); data/lua50-5.0.3/src/lib/liolib.c:344: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/lua50-5.0.3/src/lib/lstrlib.c:675:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(form+1, strfrmt, p-strfrmt+1); data/lua50-5.0.3/src/lib/lstrlib.c:738:33: [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, buff, strlen(buff)); data/lua50-5.0.3/src/llex.c:45:16: [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_assert(strlen(token2string[i])+1 <= TOKEN_LEN); data/lua50-5.0.3/src/lobject.c:165:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(out, source+1, bufflen); /* remove first char */ data/lua50-5.0.3/src/lobject.c:173:11: [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(source); data/lua50-5.0.3/src/lobject.c:174:7: [1] (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 character. strcpy(out, ""); data/lua50-5.0.3/src/lobject.c:187:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(out, source, len); data/lua50-5.0.3/src/lstring.h:21:44: [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). #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) data/lua50-5.0.3/src/ltests.c:165:20: [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). sprintf(buff+strlen(buff), "%-12s%4d %4d %4d", name, data/lua50-5.0.3/src/ltests.c:169:20: [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). sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_Bx(i)); data/lua50-5.0.3/src/ltests.c:172:20: [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). sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_sBx(i)); data/lua50-5.0.3/src/lua/lua.c:290:39: [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 docall(luaL_loadbuffer(L, s, strlen(s), name)); data/lua50-5.0.3/src/lvm.c:245:20: [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(l); /* index of first `\0' in both strings */ ANALYSIS SUMMARY: Hits = 93 Lines analyzed = 16022 in approximately 0.48 seconds (33707 lines/second) Physical Source Lines of Code (SLOC) = 12082 Hits@level = [0] 74 [1] 23 [2] 45 [3] 9 [4] 16 [5] 0 Hits@level+ = [0+] 167 [1+] 93 [2+] 70 [3+] 25 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 13.8222 [1+] 7.6974 [2+] 5.79374 [3+] 2.06919 [4+] 1.32428 [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.