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/wmcdplay-1.1/cdctl.h Examining data/wmcdplay-1.1/cdctl_freebsd.h Examining data/wmcdplay-1.1/wmcdplay.cc FINAL RESULTS: data/wmcdplay-1.1/cdctl.h:87:7: [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(device,dname); data/wmcdplay-1.1/cdctl_freebsd.h:84:7: [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(device,dname); data/wmcdplay-1.1/wmcdplay.cc:409:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(artwrkf, "%s", argv[i]); data/wmcdplay-1.1/wmcdplay.cc:416:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cddev, "%s", argv[i]); data/wmcdplay-1.1/wmcdplay.cc:423:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ledcolor, "%s", argv[i]); data/wmcdplay-1.1/wmcdplay.cc:430:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(backcolor, "%s", argv[i]); data/wmcdplay-1.1/wmcdplay.cc:437:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(position, "%s", argv[i]); data/wmcdplay-1.1/wmcdplay.cc:444:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(display, "%s", argv[i]); data/wmcdplay-1.1/wmcdplay.cc:631:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(artfilenbuf, "%s/.wmcdplay/%s", getenv("HOME"), artfilen); data/wmcdplay-1.1/wmcdplay.cc:634:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(artfilenbuf, "%s%s", SYSARTDIR, artfilen); data/wmcdplay-1.1/wmcdplay.cc:745:7: [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(block+bytes, buf); data/wmcdplay-1.1/cdctl.h:88:7: [3] (random) srand: 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. srand(getpid()); data/wmcdplay-1.1/cdctl_freebsd.h:85:7: [3] (random) srand: 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. srand(getpid()); data/wmcdplay-1.1/wmcdplay.cc:631:47: [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(artfilenbuf, "%s/.wmcdplay/%s", getenv("HOME"), artfilen); data/wmcdplay-1.1/cdctl.h:92:30: [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). if((cdfdopen = (cdfd = open(device,O_RDONLY | O_NONBLOCK))) != -1) { data/wmcdplay-1.1/cdctl_freebsd.h:89:25: [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). if(cdfdopen=(cdfd=open(device,O_RDONLY | O_NONBLOCK))!=-1){ data/wmcdplay-1.1/wmcdplay.cc:74: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 display[256]=""; data/wmcdplay-1.1/wmcdplay.cc:75: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 position[256]=""; data/wmcdplay-1.1/wmcdplay.cc:79: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 cddev[256]=CDDEV; data/wmcdplay-1.1/wmcdplay.cc:80: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 backcolor[256]=BACKCOLOR; data/wmcdplay-1.1/wmcdplay.cc:81: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 ledcolor[256]=LEDCOLOR; data/wmcdplay-1.1/wmcdplay.cc:83: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 artwrkf[256]=""; data/wmcdplay-1.1/wmcdplay.cc:115: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 trackstr[8]=""; data/wmcdplay-1.1/wmcdplay.cc:116: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 timestr[8]=""; data/wmcdplay-1.1/wmcdplay.cc:483:13: [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(trackstr, " "); data/wmcdplay-1.1/wmcdplay.cc:485:13: [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(trackstr, "%2d", cdctl->getStatusTrack()); data/wmcdplay-1.1/wmcdplay.cc:496:13: [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(timestr, " -;%02d", remain/75); data/wmcdplay-1.1/wmcdplay.cc:498:13: [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(timestr, "%2d:%02d", (pos/75)/60, (pos/75)%60); data/wmcdplay-1.1/wmcdplay.cc:556: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(timestr, "DA_TA"); data/wmcdplay-1.1/wmcdplay.cc:558: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(timestr, "NO;CD"); data/wmcdplay-1.1/wmcdplay.cc:560: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(timestr, "OP_EN"); data/wmcdplay-1.1/wmcdplay.cc:624:4: [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 artfilenbuf[256]; data/wmcdplay-1.1/wmcdplay.cc:625:12: [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). artfile=fopen(artfilen, "r"); data/wmcdplay-1.1/wmcdplay.cc:632:15: [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). artfile=fopen(artfilenbuf, "r"); data/wmcdplay-1.1/wmcdplay.cc:635:18: [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). artfile=fopen(artfilenbuf, "r"); data/wmcdplay-1.1/wmcdplay.cc:643:4: [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[256]; data/wmcdplay-1.1/wmcdplay.cc:735:4: [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[256]; data/wmcdplay-1.1/cdctl.h:86: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). device=(char *)malloc(sizeof(char)*(strlen(dname)+1)); data/wmcdplay-1.1/cdctl_freebsd.h:83: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). device=(char *)malloc(sizeof(char)*(strlen(dname)+1)); data/wmcdplay-1.1/wmcdplay.cc:175:28: [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). art_ledsize[0]=(w+1)/strlen(chrset)-1; data/wmcdplay-1.1/wmcdplay.cc:235:10: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(50000); data/wmcdplay-1.1/wmcdplay.cc:609:21: [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(size_t i=0;i<strlen(text);i++){ data/wmcdplay-1.1/wmcdplay.cc:662:40: [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(strncmp(buf, keystr[i], strlen(keystr[i]))==0){ data/wmcdplay-1.1/wmcdplay.cc:669:24: [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). sscanf(buf+strlen(keystr[keynum-1]), "%d", &art_nbtns); data/wmcdplay-1.1/wmcdplay.cc:672: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). art_hidebtns=(strstr(buf+strlen(keystr[keynum-1]), "true")!=NULL); data/wmcdplay-1.1/wmcdplay.cc:681:29: [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). fseek(artfile, -strlen(buf), SEEK_CUR); data/wmcdplay-1.1/wmcdplay.cc:698:16: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, strchr(block+strlen(keystr[keynum-1]), '\n')+1, 250); data/wmcdplay-1.1/wmcdplay.cc:698: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). strncpy(buf, strchr(block+strlen(keystr[keynum-1]), '\n')+1, 250); data/wmcdplay-1.1/wmcdplay.cc:702:68: [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(strncmp(buf, "static const char * cdplayer_xpm", strlen("static const char * cdplayer_xpm"))==0) data/wmcdplay-1.1/wmcdplay.cc:704:67: [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(strncmp(buf, "static const char * symbols_xpm", strlen("static const char * symbols_xpm"))==0){ data/wmcdplay-1.1/wmcdplay.cc:709:63: [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(strncmp(buf, "static const char * led_xpm", strlen("static const char * led_xpm"))==0){ data/wmcdplay-1.1/wmcdplay.cc:711:40: [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). art_ledsize[0]=(w+1)/strlen(chrset)-1; data/wmcdplay-1.1/wmcdplay.cc:714:66: [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(strncmp(buf, "static const char * ledsym_xpm", strlen("static const char * ledsym_xpm"))==0){ data/wmcdplay-1.1/wmcdplay.cc:719:67: [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(strncmp(buf, "static const char * ledtsel_xpm", strlen("static const char * ledtsel_xpm"))==0){ data/wmcdplay-1.1/wmcdplay.cc:743: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). int buflen=strlen(buf); ANALYSIS SUMMARY: Hits = 55 Lines analyzed = 1724 in approximately 0.06 seconds (28251 lines/second) Physical Source Lines of Code (SLOC) = 1494 Hits@level = [0] 31 [1] 18 [2] 23 [3] 3 [4] 11 [5] 0 Hits@level+ = [0+] 86 [1+] 55 [2+] 37 [3+] 14 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 57.5636 [1+] 36.8139 [2+] 24.7657 [3+] 9.37082 [4+] 7.36278 [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.