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-other-mott-happy-2.4/src/Rhappy.c Examining data/r-other-mott-happy-2.4/src/cmp.c Examining data/r-other-mott-happy-2.4/src/cmp.h Examining data/r-other-mott-happy-2.4/src/happy.h Examining data/r-other-mott-happy-2.4/src/hbcore.c Examining data/r-other-mott-happy-2.4/src/hbcore.h Examining data/r-other-mott-happy-2.4/src/hbrem.c Examining data/r-other-mott-happy-2.4/src/hbrem.h Examining data/r-other-mott-happy-2.4/src/readline.c Examining data/r-other-mott-happy-2.4/src/readline.h Examining data/r-other-mott-happy-2.4/src/stats.c Examining data/r-other-mott-happy-2.4/src/stats.h Examining data/r-other-mott-happy-2.4/src/subrout.c FINAL RESULTS: data/r-other-mott-happy-2.4/src/Rhappy.c:901:13: [4] (buffer) sscanf: 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 ( (sscanf( line, "marker %s %d %s %lf", marker_name, &(af->alleles), af->chromosome, &(af->position) ) == 4 ) || ( sscanf( line, "marker %s %d %lf", marker_name, &(af->alleles), &(af->position) ) == 3 )) { data/r-other-mott-happy-2.4/src/Rhappy.c:901:126: [4] (buffer) sscanf: 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 ( (sscanf( line, "marker %s %d %s %lf", marker_name, &(af->alleles), af->chromosome, &(af->position) ) == 4 ) || ( sscanf( line, "marker %s %d %lf", marker_name, &(af->alleles), &(af->position) ) == 3 )) { data/r-other-mott-happy-2.4/src/Rhappy.c:915:9: [4] (buffer) sscanf: 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 ( sscanf( line, "allele %s", allele_name ) == 1 ) { data/r-other-mott-happy-2.4/src/Rhappy.c:49:17: [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 ( ! (dfp = fopen( dfilename, "r" ) ) ) data/r-other-mott-happy-2.4/src/Rhappy.c:56:17: [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 ( ! (afp = fopen( afilename, "r" ) ) ) data/r-other-mott-happy-2.4/src/Rhappy.c:61:20: [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 ( ! (anfp = fopen( anfilename, "r" ) ) ) data/r-other-mott-happy-2.4/src/Rhappy.c:385: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). q->sex[q->N] = atoi(sex); data/r-other-mott-happy-2.4/src/Rhappy.c:649: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 line[256]; data/r-other-mott-happy-2.4/src/Rhappy.c:864: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 line[10000]; data/r-other-mott-happy-2.4/src/Rhappy.c:865: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 marker_name[256]; data/r-other-mott-happy-2.4/src/Rhappy.c:866: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 allele_name[256]; data/r-other-mott-happy-2.4/src/Rhappy.c:900:7: [2] (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 string. strcpy(af->chromosome,"unknown"); data/r-other-mott-happy-2.4/src/happy.h:28: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 chromosome[20]; /* the chromosome of the marker */ data/r-other-mott-happy-2.4/src/subrout.c:13: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 sampoutname[25]="SLXsamp_R.dat"; data/r-other-mott-happy-2.4/src/subrout.c:138: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 sampoutname[25]="SLsamp_R.dat"; data/r-other-mott-happy-2.4/src/Rhappy.c:80: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). if ( strlen( CHAR(STRING_ELT(missing_code,0)) ) > 0 ) { data/r-other-mott-happy-2.4/src/Rhappy.c:663:48: [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). if ( 0 == strncmp( line, "strain_names", strlen("strain_names") ) ) { data/r-other-mott-happy-2.4/src/Rhappy.c:882:46: [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). if ( 0 == strncmp( line, "strain_names", strlen("strain_names") ) ) { data/r-other-mott-happy-2.4/src/cmp.c:61:12: [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). int la = strlen(a)-1; data/r-other-mott-happy-2.4/src/cmp.c:62:12: [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). int lb = strlen(b)-1; data/r-other-mott-happy-2.4/src/readline.c:22:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((c=getc(file))) { data/r-other-mott-happy-2.4/src/readline.c:36:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((c=getc(file))) { ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 5087 in approximately 0.17 seconds (29675 lines/second) Physical Source Lines of Code (SLOC) = 3747 Hits@level = [0] 4 [1] 7 [2] 12 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 26 [1+] 22 [2+] 15 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 6.93888 [1+] 5.87136 [2+] 4.0032 [3+] 0.800641 [4+] 0.800641 [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.