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/xletters-1.1.1/xletters.c Examining data/xletters-1.1.1/xletters.h FINAL RESULTS: data/xletters-1.1.1/xletters.c:281:9: [4] (buffer) fscanf: 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 (fscanf(hsf,"%s %lu %d %ld %lu\n",hstable[i].name, data/xletters-1.1.1/xletters.c:906:3: [4] (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). strcpy(tmp1,wordpath); data/xletters-1.1.1/xletters.c:913:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp2,"%s/%s/%s",getenv("HOME"),&p[1],wordfile); data/xletters-1.1.1/xletters.c:915:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp2,"%s/%s",p,wordfile); data/xletters-1.1.1/xletters.c:595:13: [3] (random) random: 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. len = random()%5+5; data/xletters-1.1.1/xletters.c:602:37: [3] (random) random: 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. for (i=0;i<len;i++) s[i] = 33+random()%94; data/xletters-1.1.1/xletters.c:610:19: [3] (random) random: 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. do curpos = random()%wordf_len; while (wordf[curpos]!='\n'); data/xletters-1.1.1/xletters.c:647:25: [3] (random) random: 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. words[nb_words].x = random()%(WIDTH-words[nb_words].width); data/xletters-1.1.1/xletters.c:651:8: [3] (random) random: 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. +random()%(HEIGHT-(fnt_info->ascent+fnt_info->descent)))*1000; data/xletters-1.1.1/xletters.c:913:31: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. sprintf(tmp2,"%s/%s/%s",getenv("HOME"),&p[1],wordfile); data/xletters-1.1.1/xletters.c:957: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)); data/xletters-1.1.1/xletters.c:99:1: [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 deathword[MAX_WORDSIZE+1]; data/xletters-1.1.1/xletters.c:208: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 name[1024]; data/xletters-1.1.1/xletters.c:266:9: [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). hsf = fopen(SCOREFILE,"r+"); data/xletters-1.1.1/xletters.c:268: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). hsf = fopen(SCOREFILE,"w+"); data/xletters-1.1.1/xletters.c:271: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). hsf = fopen(SCOREFILE,"r"); data/xletters-1.1.1/xletters.c:290: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(hstable[i].name,"Joe_Player"); data/xletters-1.1.1/xletters.c:355: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 s[256]; data/xletters-1.1.1/xletters.c:356: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(s,"Lives: %d",lives); data/xletters-1.1.1/xletters.c:366: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 s[256]; data/xletters-1.1.1/xletters.c:368: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(s,"Score: %ld (+%ld)",score,vpoints); data/xletters-1.1.1/xletters.c:370: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(s,"Score: %ld",score); data/xletters-1.1.1/xletters.c:380: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 s[256]; data/xletters-1.1.1/xletters.c:381: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(s,"Level: %d",level); data/xletters-1.1.1/xletters.c:608: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 tmp[MAX_WORDSIZE+1]; data/xletters-1.1.1/xletters.c:622: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(s,tmp,len); data/xletters-1.1.1/xletters.c:762: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 tmp[MAX_WORDSIZE+1]; data/xletters-1.1.1/xletters.c:777:3: [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(s,tmp,len); data/xletters-1.1.1/xletters.c:827: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[KBD_1BUF_SIZE]; data/xletters-1.1.1/xletters.c:904: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 tmp1[512], tmp2[512], *p; data/xletters-1.1.1/xletters.c:917:13: [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). word_fd=open(tmp2,O_RDONLY,0); data/xletters-1.1.1/xletters.c:252:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(yours.name,pwent->pw_gecos,1000); data/xletters-1.1.1/xletters.c:575:33: [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). while (strncmp(wordf+curpos,s,strlen(s)) != 0) data/xletters-1.1.1/xletters.c:582:20: [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 (wordf[curpos+strlen(s)] == '\n') return 2; data/xletters-1.1.1/xletters.c:615: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). len = strlen(tmp); data/xletters-1.1.1/xletters.c:635:23: [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). words[nb_words].len=strlen(words[nb_words].s); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 1225 in approximately 0.05 seconds (22512 lines/second) Physical Source Lines of Code (SLOC) = 947 Hits@level = [0] 18 [1] 5 [2] 20 [3] 7 [4] 4 [5] 0 Hits@level+ = [0+] 54 [1+] 36 [2+] 31 [3+] 11 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 57.0222 [1+] 38.0148 [2+] 32.735 [3+] 11.6156 [4+] 4.22386 [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.