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-openxlsx-4.2.3/src/read_workbook.cpp Examining data/r-cran-openxlsx-4.2.3/src/write_data.cpp Examining data/r-cran-openxlsx-4.2.3/src/openxlsx.h Examining data/r-cran-openxlsx-4.2.3/src/helper_functions.cpp Examining data/r-cran-openxlsx-4.2.3/src/load_workbook.cpp Examining data/r-cran-openxlsx-4.2.3/src/write_file.cpp Examining data/r-cran-openxlsx-4.2.3/src/openxlsx_init.c Examining data/r-cran-openxlsx-4.2.3/src/write_file_2.cpp Examining data/r-cran-openxlsx-4.2.3/src/RcppExports.cpp FINAL RESULTS: data/r-cran-openxlsx-4.2.3/src/helper_functions.cpp:34:43: [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). cell_n_character[i] = sharedStrings[atoi(cell_values[i])].length() - 37; //-37 for shared string tags around text data/r-cran-openxlsx-4.2.3/src/helper_functions.cpp:224: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). xmlFile.open (s); data/r-cran-openxlsx-4.2.3/src/helper_functions.cpp:242: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). file.open(xmlFile.c_str()); data/r-cran-openxlsx-4.2.3/src/helper_functions.cpp:256: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). file.open(xmlFile.c_str()); data/r-cran-openxlsx-4.2.3/src/load_workbook.cpp:126:21: [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). min_c = atoi(buf.substr(tmp_pos + 5, endPos - tmp_pos - 5).c_str()); data/r-cran-openxlsx-4.2.3/src/load_workbook.cpp:130:21: [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). max_c = atoi(buf.substr(tmp_pos + 5, endPos - tmp_pos - 5).c_str()); data/r-cran-openxlsx-4.2.3/src/load_workbook.cpp:456:32: [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). rows_cell_ref[j] = atoi(buf.c_str()); data/r-cran-openxlsx-4.2.3/src/load_workbook.cpp:688:28: [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). int styleInd = atoi(as<std::string>(uStyleInds[j]).c_str()); data/r-cran-openxlsx-4.2.3/src/load_workbook.cpp:703: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). rows[k] = atoi(ref_j.c_str()); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:26:10: [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). file.open(xmlFile.c_str()); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:195:15: [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). row_i = atoi(xml.substr(pos + 8, endPos - pos - 8).c_str()); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:237:13: [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). row_i = atoi(row_xml_i.substr(pos + 8, endPos - pos - 8).c_str()); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:247:17: [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). row_i = atoi(row_xml_i.substr(pos + 8, endPos - pos - 8).c_str()); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:362:22: [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). ss_ind = atoi(v[i]); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:494: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 name[6]; data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:506:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(&(name[0]), "X%hu", i+1); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:516:11: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(&(name[0]), "X%hu", i+1); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:574: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 name[6]; data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:576:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(&(name[0]), "X%hu", i+1); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:704:20: [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). int firstRow = atoi(fRef.c_str()); data/r-cran-openxlsx-4.2.3/src/read_workbook.cpp:705:19: [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). int lastRow = atoi(lRef.c_str()); data/r-cran-openxlsx-4.2.3/src/write_data.cpp:172:16: [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). row[j] = atoi(rt.c_str()); data/r-cran-openxlsx-4.2.3/src/write_data.cpp:193: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 name[30]; data/r-cran-openxlsx-4.2.3/src/write_data.cpp:194:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(&(name[0]), "%d-%d", r[k], v[j]); data/r-cran-openxlsx-4.2.3/src/write_file.cpp:19: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). xmlFile.open (s); data/r-cran-openxlsx-4.2.3/src/write_file.cpp:231:36: [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). datetmp[ri] = Rcpp::Date(atoi(dt_str.substr(5,2).c_str()), atoi(dt_str.substr(8,2).c_str()), atoi(dt_str.substr(0,4).c_str()) ); data/r-cran-openxlsx-4.2.3/src/write_file.cpp:231:70: [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). datetmp[ri] = Rcpp::Date(atoi(dt_str.substr(5,2).c_str()), atoi(dt_str.substr(8,2).c_str()), atoi(dt_str.substr(0,4).c_str()) ); data/r-cran-openxlsx-4.2.3/src/write_file.cpp:231:104: [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). datetmp[ri] = Rcpp::Date(atoi(dt_str.substr(5,2).c_str()), atoi(dt_str.substr(8,2).c_str()), atoi(dt_str.substr(0,4).c_str()) ); data/r-cran-openxlsx-4.2.3/src/write_file_2.cpp:18: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). xmlFile.open (s); ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 3543 in approximately 0.10 seconds (37227 lines/second) Physical Source Lines of Code (SLOC) = 2301 Hits@level = [0] 0 [1] 0 [2] 29 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 29 [1+] 29 [2+] 29 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 12.6032 [1+] 12.6032 [2+] 12.6032 [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.