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/squishyball-0.1~svn19085/audio.c Examining data/squishyball-0.1~svn19085/loader.c Examining data/squishyball-0.1~svn19085/main.h Examining data/squishyball-0.1~svn19085/mincurses.h Examining data/squishyball-0.1~svn19085/tty.c Examining data/squishyball-0.1~svn19085/main.c Examining data/squishyball-0.1~svn19085/mincurses.c FINAL RESULTS: data/squishyball-0.1~svn19085/loader.c:263:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(pcm->matrix,mask_map[i]); data/squishyball-0.1~svn19085/main.c:405:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while((c=getopt_long(argc,argv,short_options,long_options,&long_option_index))!=EOF){ data/squishyball-0.1~svn19085/main.c:653:3: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom(time(NULL)+getpid()); data/squishyball-0.1~svn19085/audio.c:43:14: [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. unsigned char bytewise[4]; data/squishyball-0.1~svn19085/audio.c:396:12: [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. unsigned char temp[bpf]; data/squishyball-0.1~svn19085/audio.c:428:5: [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(d,temp,bpf); data/squishyball-0.1~svn19085/audio.c:598:9: [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(out,B,bpf); data/squishyball-0.1~svn19085/audio.c:624:11: [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(out,A,bpf); data/squishyball-0.1~svn19085/audio.c:644: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(out,A,fragsize); data/squishyball-0.1~svn19085/audio.c:670:5: [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(out,A,fragsize); data/squishyball-0.1~svn19085/audio.c:684:9: [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(out,A,bpf); data/squishyball-0.1~svn19085/audio.c:699:9: [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(out,B,bpf); data/squishyball-0.1~svn19085/audio.c:762:7: [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[80]; data/squishyball-0.1~svn19085/audio.c:764: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(buf,"%d",number); data/squishyball-0.1~svn19085/loader.c:42:14: [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. unsigned char bytewise[4]; data/squishyball-0.1~svn19085/loader.c:132:12: [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. unsigned char buf[8]; data/squishyball-0.1~svn19085/loader.c:154:12: [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. unsigned char buf[40]; data/squishyball-0.1~svn19085/loader.c:205: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. const char *mask_map[32]={ data/squishyball-0.1~svn19085/loader.c:431:12: [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. unsigned char buf[8]; data/squishyball-0.1~svn19085/loader.c:492:12: [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. unsigned char buf2[12]; data/squishyball-0.1~svn19085/loader.c:1271:10: [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. unsigned char buf[MAX_ID_LEN]; data/squishyball-0.1~svn19085/loader.c:1286: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 *f = fopen(path,"rb"); data/squishyball-0.1~svn19085/main.c:392: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 choice_list[MAXTRIALS]; data/squishyball-0.1~svn19085/main.c:393: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 sample_list[MAXTRIALS]; data/squishyball-0.1~svn19085/main.c:443: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). tests=atoi(optarg); data/squishyball-0.1~svn19085/mincurses.c:272:8: [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. static char outbuf[BUFF_SIZE]; data/squishyball-0.1~svn19085/mincurses.c:310:5: [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(outbuf+buf_fill,str,bytes); data/squishyball-0.1~svn19085/tty.c:45:8: [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. static char p_tl[MAXTRIALS],p_tc[MAXTRIALS]; data/squishyball-0.1~svn19085/tty.c:48:8: [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. static char timebuffer[80]; data/squishyball-0.1~svn19085/tty.c:89: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 buf[columns+1]; data/squishyball-0.1~svn19085/tty.c:124:3: [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(buf," %dch %dbit %dHz ",p_ch,p_b,p_r); data/squishyball-0.1~svn19085/tty.c:148: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 buf[columns+1]; data/squishyball-0.1~svn19085/tty.c:197: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 buf[columns+1]; data/squishyball-0.1~svn19085/tty.c:230: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 buf[columns+1]; data/squishyball-0.1~svn19085/tty.c:492: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 buf[columns+1]; data/squishyball-0.1~svn19085/tty.c:497:5: [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(buf," %d/%d trials: ",p_tn,p_tmax); data/squishyball-0.1~svn19085/tty.c:500:5: [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(p_tl,choices,n); data/squishyball-0.1~svn19085/tty.c:501:5: [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(p_tc,correct,n); data/squishyball-0.1~svn19085/tty.c:547: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 bufA[PATH_MAX]; data/squishyball-0.1~svn19085/tty.c:548: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 bufB[PATH_MAX]; data/squishyball-0.1~svn19085/tty.c:549: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 bufAn[10]; data/squishyball-0.1~svn19085/tty.c:550: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 bufBn[10]; data/squishyball-0.1~svn19085/tty.c:558: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(buf," p': %.2g ",(float)p); data/squishyball-0.1~svn19085/tty.c:560: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(buf," p': --- "); data/squishyball-0.1~svn19085/tty.c:593: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(buf," Score: %d/%d p': ",count,n); data/squishyball-0.1~svn19085/tty.c:596: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(buf,"%.2g ",(float)p); data/squishyball-0.1~svn19085/tty.c:601: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(buf,"--- "); data/squishyball-0.1~svn19085/loader.c:126:22: [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). return memcmp(path+strlen(path)-3,".sw",3)==0; data/squishyball-0.1~svn19085/loader.c:264:9: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(pcm->matrix,","); data/squishyball-0.1~svn19085/mincurses.c:204:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(STDIN_FILENO, &c2, 1); data/squishyball-0.1~svn19085/mincurses.c:323:11: [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 len=strlen(str); data/squishyball-0.1~svn19085/tty.c:75:13: [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 len = strlen(buf); data/squishyball-0.1~svn19085/tty.c:76:14: [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 len2 = strlen(s); data/squishyball-0.1~svn19085/tty.c:125:18: [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). for(;i<columns-strlen(buf);i++) data/squishyball-0.1~svn19085/tty.c:256: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(pcm_p[i]->name)>columns-4) data/squishyball-0.1~svn19085/tty.c:257:39: [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). print_into(buf,0,pcm_p[i]->name+strlen(pcm_p[i]->name)-columns+4); data/squishyball-0.1~svn19085/tty.c:478: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). int m=strlen(in); data/squishyball-0.1~svn19085/tty.c:503:18: [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(n>columns-strlen(buf)-3){ data/squishyball-0.1~svn19085/tty.c:506:19: [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). i=n-columns+strlen(buf)+6; data/squishyball-0.1~svn19085/tty.c:534: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). i+=strlen(buf); data/squishyball-0.1~svn19085/tty.c:561:14: [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). col-=strlen(buf); data/squishyball-0.1~svn19085/tty.c:562: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). Ac=strlen(bufA)+strlen(bufAn); data/squishyball-0.1~svn19085/tty.c:562:25: [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). Ac=strlen(bufA)+strlen(bufAn); data/squishyball-0.1~svn19085/tty.c:563: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). Bc=strlen(bufB)+strlen(bufBn); data/squishyball-0.1~svn19085/tty.c:563:25: [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). Bc=strlen(bufB)+strlen(bufBn); data/squishyball-0.1~svn19085/tty.c:567:39: [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). Bp = dottrim(bufB, col-Ac-strlen(bufBn)); data/squishyball-0.1~svn19085/tty.c:569:39: [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). Ap = dottrim(bufA, col-Bc-strlen(bufAn)); data/squishyball-0.1~svn19085/tty.c:571:38: [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). Ap = dottrim(bufA, col/2-strlen(bufAn)); data/squishyball-0.1~svn19085/tty.c:572:42: [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). Bp = dottrim(bufB, col-col/2-strlen(bufBn)); data/squishyball-0.1~svn19085/tty.c:615:10: [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(pcm_p[p_pl]->name)>columns-4) data/squishyball-0.1~svn19085/tty.c:616:38: [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). min_putstr(pcm_p[p_pl]->name+strlen(pcm_p[p_pl]->name)-columns+4); data/squishyball-0.1~svn19085/tty.c:623:10: [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(pcm_p[n]->name)>columns-4) data/squishyball-0.1~svn19085/tty.c:624:35: [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). min_putstr(pcm_p[n]->name+strlen(pcm_p[n]->name)-columns+4); ANALYSIS SUMMARY: Hits = 73 Lines analyzed = 4919 in approximately 0.15 seconds (33394 lines/second) Physical Source Lines of Code (SLOC) = 4113 Hits@level = [0] 179 [1] 26 [2] 44 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 252 [1+] 73 [2+] 47 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 61.2691 [1+] 17.7486 [2+] 11.4272 [3+] 0.729395 [4+] 0.243132 [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.