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-matching-4.9-7/src/cblas_dgemm.c Examining data/r-cran-matching-4.9-7/src/cblas_dasum.c Examining data/r-cran-matching-4.9-7/src/matching.h Examining data/r-cran-matching-4.9-7/src/init.c Examining data/r-cran-matching-4.9-7/src/cblas_dscal.c Examining data/r-cran-matching-4.9-7/src/cblas.h Examining data/r-cran-matching-4.9-7/src/scythematrix.cc Examining data/r-cran-matching-4.9-7/src/scythematrix.h Examining data/r-cran-matching-4.9-7/src/matching.cc Examining data/r-cran-matching-4.9-7/inst/extras/cblas_dgemm.c Examining data/r-cran-matching-4.9-7/inst/extras/cblas_dasum.c Examining data/r-cran-matching-4.9-7/inst/extras/cblas_dscal.c Examining data/r-cran-matching-4.9-7/inst/extras/cblas_dtrmm.c Examining data/r-cran-matching-4.9-7/inst/extras/cblas.h Examining data/r-cran-matching-4.9-7/inst/extras/malloc.c Examining data/r-cran-matching-4.9-7/inst/extras/cblas_dsymm.c FINAL RESULTS: data/r-cran-matching-4.9-7/inst/extras/malloc.c:1308:27: [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). (dev_zero_fd = open("/dev/zero", O_RDWR), \ data/r-cran-matching-4.9-7/inst/extras/malloc.c:2432:16: [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. unsigned char buf[sizeof(size_t)]; data/r-cran-matching-4.9-7/inst/extras/malloc.c:2434: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). if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && data/r-cran-matching-4.9-7/inst/extras/malloc.c:3794: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(newmem, oldmem, (oc < bytes)? oc : bytes); data/r-cran-matching-4.9-7/src/matching.cc:565:6: [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(tI_tmp.data, I.data, OldMatchCount*sizeof(double)); data/r-cran-matching-4.9-7/src/matching.cc:566:6: [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(tIM_tmp.data, IM.data, OldMatchCount*sizeof(double)); data/r-cran-matching-4.9-7/src/matching.cc:567:6: [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(tW_tmp.data, W.data, OldMatchCount*sizeof(double)); data/r-cran-matching-4.9-7/src/matching.cc:2100: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(tI_tmp.data, I.data, OldMatchCount*sizeof(double)); data/r-cran-matching-4.9-7/src/matching.cc:2101: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(tIM_tmp.data, IM.data, OldMatchCount*sizeof(double)); data/r-cran-matching-4.9-7/src/matching.cc:2102: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(tW_tmp.data, W.data, OldMatchCount*sizeof(double)); data/r-cran-matching-4.9-7/src/matching.cc:2117: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(IM.data+MCindx, IMt.data, IMt.size*sizeof(double)); data/r-cran-matching-4.9-7/src/scythematrix.cc:117:2: [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(data, inputarray, size*sizeof(double)); data/r-cran-matching-4.9-7/src/scythematrix.cc:138:2: [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(data, old_Matrix.data, size*sizeof(double)); data/r-cran-matching-4.9-7/src/scythematrix.cc:159:2: [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(data, B.data, size * sizeof(double)); data/r-cran-matching-4.9-7/src/scythematrix.cc:192:2: [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(newdata.data, data+i*colsize, newcolsize*sizeof(double)); data/r-cran-matching-4.9-7/src/scythematrix.cc:263:2: [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(newdata.data, data+i*colsize, newcolsize*sizeof(double)); data/r-cran-matching-4.9-7/inst/extras/malloc.c:645:32: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. #define dlmemalign memalign data/r-cran-matching-4.9-7/inst/extras/malloc.c:2435:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, buf, sizeof(buf)) == sizeof(buf)) { ANALYSIS SUMMARY: Hits = 18 Lines analyzed = 12663 in approximately 0.36 seconds (34981 lines/second) Physical Source Lines of Code (SLOC) = 7112 Hits@level = [0] 3 [1] 2 [2] 16 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 21 [1+] 18 [2+] 16 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 2.95276 [1+] 2.53093 [2+] 2.24972 [3+] 0 [4+] 0 [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.