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/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c Examining data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_exe.c FINAL RESULTS: data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:54:3: [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, __VA_ARGS__ ); \ data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:90: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(progname, &argv[0][k]); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:104: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( scriptpath, dirpath ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:111:5: [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( scriptpath, progname ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:211: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( luatexfname, (is_jit ? "luajittex.dll":"luatex.dll") ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:244: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( luatexfname,binary); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:247: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( cmdline, luatexpath ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:249: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( cmdline, scriptpath ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:253:5: [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( cmdline, progname ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:268: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( cmdline, argstr ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:146:5: [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. getenv("PATH"), // was dirpath, // path to search (optional) data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:155:5: [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. getenv("PATH") , // was dirpath, // path to search (optional) data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:212:20: [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. if ( dllluatex = LoadLibrary(luatexpath) ) data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:283:8: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. if( !CreateProcess( data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:283:8: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. if( !CreateProcess( data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:58:8: [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 cmdline[MAX_CMD]; data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:59:8: [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 dirpath[MAX_PATH]; data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:60:8: [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 progname[MAX_PATH]; data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:61:8: [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 scriptpath[MAX_PATH]; data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:62:8: [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 luatexpath[MAX_PATH]; data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:112:5: [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( scriptpath, ".lua" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:114:5: [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( scriptpath, "mtxrun.lua" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:115: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( progname, "base" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:118:5: [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( scriptpath, "mtxrun.lua" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:120:5: [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( scriptpath, "mtxrun.lua" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:245:3: [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( cmdline, " --luaonly " ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:248: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( cmdline, "\" \"" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:252:5: [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( cmdline, " --script " ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:88: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). k = strlen(argv[0]); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:95: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). if (strncmp(progname + strlen(progname) - 3, "jit", 3) == 0) { data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:97:17: [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). progname[strlen(progname) - 3]='\0'; data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:105: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). k = strlen(progname); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:107: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). if ( strlen(dirpath) + k + 4 >= MAX_PATH ) data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:246:3: [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( cmdline, "\"" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:250:3: [1] (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 character. strcat( cmdline, "\"" ); data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:266: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). if ( strlen(cmdline) + strlen(argstr) >= MAX_CMD ) data/context-2020.03.10.20200331/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c:266: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). if ( strlen(cmdline) + strlen(argstr) >= MAX_CMD ) ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 314 in approximately 0.47 seconds (667 lines/second) Physical Source Lines of Code (SLOC) = 179 Hits@level = [0] 1 [1] 9 [2] 13 [3] 5 [4] 10 [5] 0 Hits@level+ = [0+] 38 [1+] 37 [2+] 28 [3+] 15 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 212.291 [1+] 206.704 [2+] 156.425 [3+] 83.7989 [4+] 55.8659 [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.