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-spp-1.16.0/src/pc.h Examining data/r-cran-spp-1.16.0/src/maqread.cpp Examining data/r-cran-spp-1.16.0/src/maqmap.c Examining data/r-cran-spp-1.16.0/src/peaks.cpp Examining data/r-cran-spp-1.16.0/src/bed2vector.cpp Examining data/r-cran-spp-1.16.0/src/api_global.h Examining data/r-cran-spp-1.16.0/src/wdl.cpp Examining data/r-cran-spp-1.16.0/src/const.h Examining data/r-cran-spp-1.16.0/src/cdensum.c Examining data/r-cran-spp-1.16.0/src/maqmap.h Examining data/r-cran-spp-1.16.0/src/spp_init.c FINAL RESULTS: data/r-cran-spp-1.16.0/src/bed2vector.cpp:151:18: [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 fstart=atoi(str_start.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:153: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). int fend=atoi(str_end.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:286:5: [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). nm=atoi((str_nm.c_str()+1)); data/r-cran-spp-1.16.0/src/bed2vector.cpp:292: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). int len=atoi(str_len.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:295: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). int fpos=atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:405: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 cline[1024]; data/r-cran-spp-1.16.0/src/bed2vector.cpp:442:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:466:5: [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). nm=atoi((str_nm.c_str()+1)); data/r-cran-spp-1.16.0/src/bed2vector.cpp:472: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). int len=atoi(str_len.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:475: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). int fpos=atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:635:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:659:5: [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). nm=atoi((str_nm.c_str()+1)); data/r-cran-spp-1.16.0/src/bed2vector.cpp:671: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). int fpos=atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:686:6: [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). nm1=atoi(nms.substr(0,nms.size()-1).c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:691:6: [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). nm2=atoi(nms.substr(0,nms.size()-1).c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:829:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:857:5: [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). nm=atoi((str_nm.c_str()+1)); data/r-cran-spp-1.16.0/src/bed2vector.cpp:864: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). int fpos=atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1017:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1068: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). int fpos=atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1231:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1269: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). int nm0=atoi(str_nm0.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1278:10: [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 nm1=atoi(str_nm1.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1287:12: [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 nm2=atoi(str_nm2.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1318:5: [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). if(atoi(&lc)==nm) { data/r-cran-spp-1.16.0/src/bed2vector.cpp:1343: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 pos=strand*atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1517:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1556: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). int fpos=atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1731:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1781: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). int len=atoi(str_tend.c_str())-atoi(str_tstart.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1781:38: [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 len=atoi(str_tend.c_str())-atoi(str_tstart.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1791:10: [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). fpos=-1*atoi(str_endpos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1793:7: [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). fpos=atoi(str_startpos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1797:14: [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 nm=atoi(str_ndel.c_str())+atoi(str_nins.c_str())+atoi(str_nsub.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1797:37: [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 nm=atoi(str_ndel.c_str())+atoi(str_nins.c_str())+atoi(str_nsub.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1797:60: [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 nm=atoi(str_ndel.c_str())+atoi(str_nins.c_str())+atoi(str_nsub.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1957:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1978: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). int fpos=atoi(str_pos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1984:14: [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 nm=atoi(str_nm.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:1985: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). int len=atoi(str_len.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2135:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2162:7: [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). fpos=atoi(str_spos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2164:10: [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). fpos=-1*atoi(str_epos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2166:14: [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 nm=atoi(str_qual.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2289:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2330:5: [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). nm=atoi(str_mm.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2333: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). int fpos=atoi(str_spos.c_str());; data/r-cran-spp-1.16.0/src/bed2vector.cpp:2460:11: [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 *f=fopen(fname,"rb"); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2506:10: [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). fpos=-1*atoi(str_endpos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2508:7: [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). fpos=atoi(str_startpos.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2515: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 nblocks=atoi(str_nblocks.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2523:10: [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 sgs=atoi(str_sgs.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2525:11: [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 slen=atoi(str_slen.c_str()); data/r-cran-spp-1.16.0/src/bed2vector.cpp:2527:10: [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 snm=atoi(str_snm.c_str()); data/r-cran-spp-1.16.0/src/maqmap.h:46: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 name[MAX_NAMELEN]; data/r-cran-spp-1.16.0/src/bed2vector.cpp:84:8: [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). cline[strlen(cline)-1]='\0'; data/r-cran-spp-1.16.0/src/bed2vector.cpp:293:43: [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). string chr=*sit++; chr=chr.substr(3,strlen(chr.c_str())); data/r-cran-spp-1.16.0/src/bed2vector.cpp:473:43: [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). string chr=*sit++; chr=chr.substr(3,strlen(chr.c_str())); data/r-cran-spp-1.16.0/src/maqmap.c:37:9: [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 = strlen(mm->ref_name[i]) + 1; ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 4948 in approximately 0.12 seconds (40679 lines/second) Physical Source Lines of Code (SLOC) = 3675 Hits@level = [0] 0 [1] 4 [2] 55 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 59 [1+] 59 [2+] 55 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 16.0544 [1+] 16.0544 [2+] 14.966 [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.