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-readstata13-0.9.2/inst/include/read_pre13_dta.h Examining data/r-cran-readstata13-0.9.2/inst/include/read_data.h Examining data/r-cran-readstata13-0.9.2/inst/include/readstata.h Examining data/r-cran-readstata13-0.9.2/inst/include/read_dta.h Examining data/r-cran-readstata13-0.9.2/inst/include/swap_endian.h Examining data/r-cran-readstata13-0.9.2/inst/include/statadefines.h Examining data/r-cran-readstata13-0.9.2/src/read.cpp Examining data/r-cran-readstata13-0.9.2/src/read_data.cpp Examining data/r-cran-readstata13-0.9.2/src/save_dta.cpp Examining data/r-cran-readstata13-0.9.2/src/read_pre13_dta.cpp Examining data/r-cran-readstata13-0.9.2/src/save_pre13_dta.cpp Examining data/r-cran-readstata13-0.9.2/src/read_dta.cpp Examining data/r-cran-readstata13-0.9.2/src/RcppExports.cpp FINAL RESULTS: data/r-cran-readstata13-0.9.2/inst/include/readstata.h:73:3: [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 uint48[6]; data/r-cran-readstata13-0.9.2/src/read.cpp:42:15: [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). if ((file = fopen(filePath, "rb")) == NULL) data/r-cran-readstata13-0.9.2/src/read_dta.cpp:42:26: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int8_t const release = atoi(version.c_str()); data/r-cran-readstata13-0.9.2/src/save_dta.cpp:49:27: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). uint8_t const release = atoi(version.c_str()); data/r-cran-readstata13-0.9.2/src/save_dta.cpp:477:13: [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 z[8]; data/r-cran-readstata13-0.9.2/src/save_dta.cpp:484:13: [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(&z[0], &v, sizeof(v)); data/r-cran-readstata13-0.9.2/src/save_dta.cpp:488:13: [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(&z[2], &o, 6); data/r-cran-readstata13-0.9.2/src/save_dta.cpp:500:13: [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 z[8]; data/r-cran-readstata13-0.9.2/src/save_dta.cpp:507:13: [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(&z[0], &v, sizeof(v)); data/r-cran-readstata13-0.9.2/src/save_dta.cpp:511:13: [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(&z[3], &o, 5); data/r-cran-readstata13-0.9.2/src/save_pre13_dta.cpp:142: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 c[2]; data/r-cran-readstata13-0.9.2/src/save_pre13_dta.cpp:147:11: [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(c, "d"); data/r-cran-readstata13-0.9.2/src/save_pre13_dta.cpp:152:11: [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(c, "f"); data/r-cran-readstata13-0.9.2/src/save_pre13_dta.cpp:157:11: [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(c, "l"); data/r-cran-readstata13-0.9.2/src/save_pre13_dta.cpp:162:11: [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(c, "i"); data/r-cran-readstata13-0.9.2/src/save_pre13_dta.cpp:167:11: [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(c,"b"); ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 3267 in approximately 0.11 seconds (28575 lines/second) Physical Source Lines of Code (SLOC) = 2035 Hits@level = [0] 3 [1] 5 [2] 11 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 19 [1+] 16 [2+] 11 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 9.33661 [1+] 7.86241 [2+] 5.40541 [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.