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/rakudo-2020.10/src/vm/moar/ops/perl6_ops.c Examining data/rakudo-2020.10/src/vm/moar/runner/main.c Examining data/rakudo-2020.10/t/04-nativecall/00-misc.c Examining data/rakudo-2020.10/t/04-nativecall/01-argless.c Examining data/rakudo-2020.10/t/04-nativecall/02-simple-args.c Examining data/rakudo-2020.10/t/04-nativecall/03-simple-returns.c Examining data/rakudo-2020.10/t/04-nativecall/04-pointers.c Examining data/rakudo-2020.10/t/04-nativecall/05-arrays.c Examining data/rakudo-2020.10/t/04-nativecall/06-struct.c Examining data/rakudo-2020.10/t/04-nativecall/07-writebarrier.c Examining data/rakudo-2020.10/t/04-nativecall/08-callbacks.c Examining data/rakudo-2020.10/t/04-nativecall/09-nativecast.c Examining data/rakudo-2020.10/t/04-nativecall/10-cglobals.c Examining data/rakudo-2020.10/t/04-nativecall/11-cpp.cpp Examining data/rakudo-2020.10/t/04-nativecall/12-sizeof.c Examining data/rakudo-2020.10/t/04-nativecall/13-cpp-mangling.cpp Examining data/rakudo-2020.10/t/04-nativecall/13-union.c Examining data/rakudo-2020.10/t/04-nativecall/14-rw-attrs.c Examining data/rakudo-2020.10/t/04-nativecall/15-rw-args.c Examining data/rakudo-2020.10/t/04-nativecall/19-function-pointers.c Examining data/rakudo-2020.10/t/04-nativecall/20-concurrent.c Examining data/rakudo-2020.10/t/04-nativecall/21-callback-other-thread.c Examining data/rakudo-2020.10/t/04-nativecall/22-method.c Examining data/rakudo-2020.10/t/spectest.data.6.c FINAL RESULTS: data/rakudo-2020.10/t/spectest.data.6.c:737:17: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. S16-filehandles/chmod.t data/rakudo-2020.10/src/vm/moar/runner/main.c:130:9: [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(*out_home, env_home); data/rakudo-2020.10/t/spectest.data.6.c:869:8: [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. S29-os/system.t data/rakudo-2020.10/t/spectest.data.6.c:1026:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. S32-str/sprintf.t data/rakudo-2020.10/src/vm/moar/runner/main.c:121:32: [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 *env_home = getenv(env_var); data/rakudo-2020.10/src/vm/moar/runner/main.c:346:9: [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. if (getenv("MVM_TELEMETRY_LOG")) { data/rakudo-2020.10/src/vm/moar/runner/main.c:349:38: [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. snprintf(path, 255, "%s.%d", getenv("MVM_TELEMETRY_LOG"), data/rakudo-2020.10/src/vm/moar/runner/main.c:395:9: [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. if (getenv("PERL6_HOME")) { data/rakudo-2020.10/src/vm/moar/runner/main.c:474:9: [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. if (getenv("MVM_TELEMETRY_LOG") && telemeh_inited) { data/rakudo-2020.10/src/vm/moar/runner/main.c:81:29: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). const int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0); data/rakudo-2020.10/src/vm/moar/runner/main.c:83:5: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, path, -1, (LPWSTR)wpath, len); data/rakudo-2020.10/src/vm/moar/runner/main.c:227:11: [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. const char nqp_rel_path[14] = "/../share/nqp"; data/rakudo-2020.10/src/vm/moar/runner/main.c:229:11: [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. const char nqp_check_path[28] = "/lib/NQPCORE.setting.moarvm"; data/rakudo-2020.10/src/vm/moar/runner/main.c:236:11: [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. const char perl6_rel_path[16] = "/../share/perl6"; data/rakudo-2020.10/src/vm/moar/runner/main.c:238:11: [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. const char perl6_check_path[22] = "/runtime/perl6.moarvm"; data/rakudo-2020.10/src/vm/moar/runner/main.c:241: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 *lib_path[3]; data/rakudo-2020.10/src/vm/moar/runner/main.c:347: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 path[256]; data/rakudo-2020.10/src/vm/moar/runner/main.c:356:14: [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). fp = fopen(path, "w"); data/rakudo-2020.10/src/vm/moar/runner/main.c:367: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(exec_dir_path_temp, exec_path, exec_path_size + 1); data/rakudo-2020.10/src/vm/moar/runner/main.c:372: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(exec_dir_path, exec_dir_path_temp, exec_dir_path_size + 1); data/rakudo-2020.10/src/vm/moar/runner/main.c:422: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(lib_path[0], nqp_home, nqp_home_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:423: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(lib_path[1], rakudo_home, rakudo_home_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:424: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(lib_path[2], rakudo_home, rakudo_home_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:425: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(perl6_file, rakudo_home, rakudo_home_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:428: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(lib_path[0] + nqp_home_size, "\\lib"); data/rakudo-2020.10/src/vm/moar/runner/main.c:429: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(lib_path[1] + rakudo_home_size, "\\lib"); data/rakudo-2020.10/src/vm/moar/runner/main.c:430: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(lib_path[2] + rakudo_home_size, "\\runtime"); data/rakudo-2020.10/src/vm/moar/runner/main.c:432: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(perl6_file + rakudo_home_size, "\\runtime\\perl6-debug.moarvm"); data/rakudo-2020.10/src/vm/moar/runner/main.c:434: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(perl6_file + rakudo_home_size, "\\runtime\\perl6.moarvm"); data/rakudo-2020.10/src/vm/moar/runner/main.c:437: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(lib_path[0] + nqp_home_size, "/lib"); data/rakudo-2020.10/src/vm/moar/runner/main.c:438: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(lib_path[1] + rakudo_home_size, "/lib"); data/rakudo-2020.10/src/vm/moar/runner/main.c:439: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(lib_path[2] + rakudo_home_size, "/runtime"); data/rakudo-2020.10/src/vm/moar/runner/main.c:441: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(perl6_file + rakudo_home_size, "/runtime/perl6-debug.moarvm"); data/rakudo-2020.10/src/vm/moar/runner/main.c:443: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(perl6_file + rakudo_home_size, "/runtime/perl6.moarvm"); data/rakudo-2020.10/t/spectest.data.6.c:584:11: [2] (misc) open: 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). S12-class/open.t data/rakudo-2020.10/t/spectest.data.6.c:744:17: [2] (misc) open: 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). S16-filehandles/open.t data/rakudo-2020.10/t/spectest.data.6.c:747:14: [2] (misc) open: 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). S16-io/basic-open.t data/rakudo-2020.10/t/spectest.data.6.c:929:8: [2] (misc) open: 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). S32-io/open.t data/rakudo-2020.10/src/vm/moar/runner/main.c:51:23: [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 str_len = strlen(str); data/rakudo-2020.10/src/vm/moar/runner/main.c:52:23: [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 want_len = strlen(want); data/rakudo-2020.10/src/vm/moar/runner/main.c:125: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). home_size = strlen(*out_home); data/rakudo-2020.10/src/vm/moar/runner/main.c:128: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). home_size = strlen(env_home); data/rakudo-2020.10/src/vm/moar/runner/main.c:142: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). home_size = strlen(*out_home); data/rakudo-2020.10/src/vm/moar/runner/main.c:147:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(*out_home, exec_dir_path, home_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:148: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_home, rel_home, rel_home_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:153:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(check_file_path, *out_home, home_size + check_file_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:154:5: [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(check_file_path, check_file, check_file_size); data/rakudo-2020.10/src/vm/moar/runner/main.c:162:52: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int set_std_handle_to_nul(FILE *file, int fd, BOOL read, int std_handle_type) { data/rakudo-2020.10/src/vm/moar/runner/main.c:191:36: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (freopen_s(&stream, "NUL:", read ? "r" : "w", file) != 0) data/rakudo-2020.10/src/vm/moar/runner/main.c:275:22: [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). exec_path_size = strlen(exec_path); data/rakudo-2020.10/src/vm/moar/runner/main.c:312:46: [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). char *portstr = argv[argi] + strlen("--debug-port="); data/rakudo-2020.10/src/vm/moar/runner/main.c:328:51: [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). option_rakudo_home = argv[argi] + strlen("--rakudo-home="); data/rakudo-2020.10/src/vm/moar/runner/main.c:370: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). exec_dir_path_size = strlen(exec_dir_path_temp); data/rakudo-2020.10/src/vm/moar/runner/main.c:375: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). exec_dir_path_size = strlen(exec_dir_path); data/rakudo-2020.10/src/vm/moar/runner/main.c:389: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). nqp_home_size = strlen(nqp_home); data/rakudo-2020.10/src/vm/moar/runner/main.c:413:24: [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). rakudo_home_size = strlen(rakudo_home); data/rakudo-2020.10/t/04-nativecall/00-misc.c:14:12: [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 strlen(x); data/rakudo-2020.10/t/04-nativecall/05-arrays.c:35:18: [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 (int)(strlen(arr[0]) + strlen(arr[1])); data/rakudo-2020.10/t/04-nativecall/05-arrays.c:35:35: [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 (int)(strlen(arr[0]) + strlen(arr[1])); data/rakudo-2020.10/t/spectest.data.6.c:751:8: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). S16-io/getc.t data/rakudo-2020.10/t/spectest.data.6.c:933:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). S32-io/socket-recv-vs-read.t ANALYSIS SUMMARY: Hits = 61 Lines analyzed = 3466 in approximately 0.43 seconds (8111 lines/second) Physical Source Lines of Code (SLOC) = 3059 Hits@level = [0] 7 [1] 23 [2] 29 [3] 5 [4] 3 [5] 1 Hits@level+ = [0+] 68 [1+] 61 [2+] 38 [3+] 9 [4+] 4 [5+] 1 Hits/KSLOC@level+ = [0+] 22.2295 [1+] 19.9412 [2+] 12.4224 [3+] 2.94214 [4+] 1.30762 [5+] 0.326904 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.