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-e1071-1.7-4/src/floyd.c Examining data/r-cran-e1071-1.7-4/src/init.c Examining data/r-cran-e1071-1.7-4/src/svm.cpp Examining data/r-cran-e1071-1.7-4/src/cmeans.c Examining data/r-cran-e1071-1.7-4/src/svm.h Examining data/r-cran-e1071-1.7-4/src/cshell.c Examining data/r-cran-e1071-1.7-4/src/Rsvm.c FINAL RESULTS: data/r-cran-e1071-1.7-4/src/Rsvm.c:272:2: [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(*error, s); data/r-cran-e1071-1.7-4/src/svm.cpp:59:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf,fmt,ap); data/r-cran-e1071-1.7-4/src/svm.cpp:2782:48: [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. #define FSCANF(_stream, _format, _var) do{ if (fscanf(_stream, _format, _var) != 1) return false; }while(0) data/r-cran-e1071-1.7-4/src/Rsvm.c:252: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(par.weight, weights, par.nr_weight * sizeof(double)); data/r-cran-e1071-1.7-4/src/Rsvm.c:254: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(par.weight_label, weightlabels, par.nr_weight * sizeof(int)); data/r-cran-e1071-1.7-4/src/Rsvm.c:287: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 (rho, model->rho, *nclasses * (*nclasses - 1)/2 * sizeof(double)); data/r-cran-e1071-1.7-4/src/Rsvm.c:293: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(probA, model->probA, data/r-cran-e1071-1.7-4/src/Rsvm.c:295: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(probB, model->probB, data/r-cran-e1071-1.7-4/src/Rsvm.c:301: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 (coefs + i * *nr, model->sv_coef[i], *nr * sizeof (double)); data/r-cran-e1071-1.7-4/src/Rsvm.c:304: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 (labels, model->label, *nclasses * sizeof(int)); data/r-cran-e1071-1.7-4/src/Rsvm.c:305: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 (nSV, model->nSV, *nclasses * sizeof(int)); data/r-cran-e1071-1.7-4/src/Rsvm.c:369: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 (m.sv_coef[i], coefs + i*m.l, m.l * sizeof (double)); data/r-cran-e1071-1.7-4/src/Rsvm.c:461: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 (m.sv_coef[i], coefs + i*m.l, m.l * sizeof (double)); data/r-cran-e1071-1.7-4/src/svm.cpp:27: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((void *)dst,(void *)src,sizeof(T)*n); data/r-cran-e1071-1.7-4/src/svm.cpp:56: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 buf[BUFSIZ]; data/r-cran-e1071-1.7-4/src/svm.cpp:2659: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). FILE *fp = fopen(model_file_name,"w"); data/r-cran-e1071-1.7-4/src/svm.cpp:2791: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 cmd[81]; data/r-cran-e1071-1.7-4/src/svm.cpp:2899: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). FILE *fp = fopen(model_file_name,"rb"); data/r-cran-e1071-1.7-4/src/svm.cpp:2768:15: [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 = (int) strlen(line); data/r-cran-e1071-1.7-4/src/svm.cpp:2881:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(fp); ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 4653 in approximately 0.14 seconds (33975 lines/second) Physical Source Lines of Code (SLOC) = 3792 Hits@level = [0] 27 [1] 2 [2] 15 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 47 [1+] 20 [2+] 18 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 12.3945 [1+] 5.27426 [2+] 4.74684 [3+] 0.791139 [4+] 0.791139 [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.