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/r-cran-sys-3.4/src/exec.c Examining data/r-cran-sys-3.4/src/init.c Examining data/r-cran-sys-3.4/src/win32/exec.c FINAL RESULTS: data/r-cran-sys-3.4/src/exec.c:224:5: [4] (shell) execvp: 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. execvp(CHAR(STRING_ELT(command, 0)), argv); data/r-cran-sys-3.4/src/exec.c:83:12: [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). int fd = open(file, O_RDONLY); //lowest numbered FD should be 0 data/r-cran-sys-3.4/src/exec.c:89:12: [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). int fd = open(file, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); data/r-cran-sys-3.4/src/exec.c:132: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(RAW(str), buf, len); data/r-cran-sys-3.4/src/exec.c:140: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[65336]; data/r-cran-sys-3.4/src/exec.c:216: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 * argv[len + 1]; data/r-cran-sys-3.4/src/win32/exec.c:18: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 buf[1000], *p; data/r-cran-sys-3.4/src/win32/exec.c:67:13: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int len = MultiByteToWideChar( CP_UTF8 , 0 , str , -1, NULL , 0 ); data/r-cran-sys-3.4/src/win32/exec.c:69:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar( CP_UTF8 , 0 , str , -1, *wstr , len ); data/r-cran-sys-3.4/src/win32/exec.c:97: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(RAW(str), buf, len); data/r-cran-sys-3.4/src/win32/exec.c:108: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[65336]; data/r-cran-sys-3.4/src/win32/exec.c:135: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[len]; data/r-cran-sys-3.4/src/exec.c:103:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int n = read(fd, &child_errno, sizeof(child_errno)); data/r-cran-sys-3.4/src/exec.c:141:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(pipe_out[r], buffer, sizeof(buffer))) > 0) data/r-cran-sys-3.4/src/exec.c:313:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100*1000); data/r-cran-sys-3.4/src/win32/exec.c:23: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). p = buf+strlen(buf) -1; data/r-cran-sys-3.4/src/win32/exec.c:25: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). p = buf+strlen(buf) -1; data/r-cran-sys-3.4/src/win32/exec.c:27: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). p = buf+strlen(buf) -1; data/r-cran-sys-3.4/src/win32/exec.c:84:8: [1] (buffer) wcsncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or automatically resizing strings. if(wcsncat(out, arg, len) == NULL) data/r-cran-sys-3.4/src/win32/exec.c:86:35: [1] (buffer) wcsncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or automatically resizing strings. if(i < Rf_length(args) - 1 && wcsncat(out, space, spacelen) == NULL) data/r-cran-sys-3.4/src/win32/exec.c:230:6: [1] (buffer) wcslen: 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(wcslen(argv) >= 32768) ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 691 in approximately 0.04 seconds (16285 lines/second) Physical Source Lines of Code (SLOC) = 540 Hits@level = [0] 2 [1] 9 [2] 11 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 23 [1+] 21 [2+] 12 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 42.5926 [1+] 38.8889 [2+] 22.2222 [3+] 1.85185 [4+] 1.85185 [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.