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/modplugtools-0.5.3/mpplay/modplugplay.c Examining data/modplugtools-0.5.3/mp123/modplug123.c FINAL RESULTS: data/modplugtools-0.5.3/mp123/modplug123.c:371:5: [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(songname, ModPlug_GetName(f2)); data/modplugtools-0.5.3/mp123/modplug123.c:381:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(status,"playing %s (%%d.%%d/%d\") (%%d/%%d/%%d) \b\b\b\b",songname,ModPlug_GetLength(f2)/1000); data/modplugtools-0.5.3/mp123/modplug123.c:382:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (loop) sprintf(status,"looping %s (%%d.%%d/%d\") (%%d/%%d/%%d) \b\b\b\b",songname,ModPlug_GetLength(f2)/1000); data/modplugtools-0.5.3/mp123/modplug123.c:400:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(status,tv.tv_sec-tvstart.tv_sec-tvptotal.tv_sec,tv.tv_usec/100000,format.rate,format.channels,settings.mBits/*,rev,revdly,sur,surdly,bas,basrng*/); data/modplugtools-0.5.3/mpplay/modplugplay.c:440:5: [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(songname, ModPlug_GetName(f2)); data/modplugtools-0.5.3/mpplay/modplugplay.c:450:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(status,"playing %s (%%d.%%d/%d\") (%%d/%%d/%%d%%s) \b\b\b\b",songname,ModPlug_GetLength(f2)/1000); data/modplugtools-0.5.3/mpplay/modplugplay.c:451:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (loop) sprintf(status,"looping %s (%%d.%%d/%d\") (%%d/%%d/%%d%%s) \b\b\b\b",songname,ModPlug_GetLength(f2)/1000); data/modplugtools-0.5.3/mpplay/modplugplay.c:469:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(status,tv.tv_sec-tvstart.tv_sec-tvptotal.tv_sec,tv.tv_usec/100000,speed,channels,settings.mBits/*,rev,revdly,sur,surdly,bas,basrng*/); data/modplugtools-0.5.3/mp123/modplug123.c:125:4: [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. s=getenv("LINES"); if (s) t->y=strtol(s,NULL,10); else t->y=25; data/modplugtools-0.5.3/mp123/modplug123.c:126:4: [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. s=getenv("COLUMNS"); if (s) t->x=strtol(s,NULL,10); else t->x=80; data/modplugtools-0.5.3/mp123/modplug123.c:313:5: [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(time(NULL)); data/modplugtools-0.5.3/mpplay/modplugplay.c:125:4: [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. s=getenv("LINES"); if (s) t->y=strtol(s,NULL,10); else t->y=25; data/modplugtools-0.5.3/mpplay/modplugplay.c:126:4: [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. s=getenv("COLUMNS"); if (s) t->x=strtol(s,NULL,10); else t->x=80; data/modplugtools-0.5.3/mpplay/modplugplay.c:339:5: [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(time(NULL)); data/modplugtools-0.5.3/mp123/modplug123.c:96: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 audio_buffer[BUF_SIZE]; data/modplugtools-0.5.3/mp123/modplug123.c:197: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). f = fopen(filename, "rb"); data/modplugtools-0.5.3/mp123/modplug123.c:222: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 status[161]; data/modplugtools-0.5.3/mp123/modplug123.c:223: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 songname[41]; data/modplugtools-0.5.3/mp123/modplug123.c:224: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 notpaus[4]; data/modplugtools-0.5.3/mp123/modplug123.c:279: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 buffer[128]; data/modplugtools-0.5.3/mp123/modplug123.c:540:8: [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(status+4,"loop",4); data/modplugtools-0.5.3/mp123/modplug123.c:542:8: [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(status+4,"play",4); data/modplugtools-0.5.3/mp123/modplug123.c:550:8: [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(notpaus,status+4,4); data/modplugtools-0.5.3/mp123/modplug123.c:551:8: [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(status+4,"paus",4); data/modplugtools-0.5.3/mp123/modplug123.c:554:8: [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(status+4,notpaus,4); data/modplugtools-0.5.3/mpplay/modplugplay.c:96: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 audio_buffer[BUF_SIZE]; data/modplugtools-0.5.3/mpplay/modplugplay.c:193: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 s[sz]; data/modplugtools-0.5.3/mpplay/modplugplay.c:194: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 t[sz]; data/modplugtools-0.5.3/mpplay/modplugplay.c:225: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). f = fopen(filename, "rb"); data/modplugtools-0.5.3/mpplay/modplugplay.c:244:19: [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 ((mixer_fd=open("/dev/mixer", O_RDONLY | O_NONBLOCK, 0)) == -1) { data/modplugtools-0.5.3/mpplay/modplugplay.c:265:19: [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 ((mixer_fd=open("/dev/mixer", O_RDONLY | O_NONBLOCK, 0)) == -1) { data/modplugtools-0.5.3/mpplay/modplugplay.c:285: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 status[161]; data/modplugtools-0.5.3/mpplay/modplugplay.c:286: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 songname[41]; data/modplugtools-0.5.3/mpplay/modplugplay.c:287: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 notpaus[4]; data/modplugtools-0.5.3/mpplay/modplugplay.c:300: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 buffer[128]; data/modplugtools-0.5.3/mpplay/modplugplay.c:371:19: [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 ((audio_fd=open(DEVICE_NAME, O_WRONLY | O_NONBLOCK, 0)) == -1) { data/modplugtools-0.5.3/mpplay/modplugplay.c:378:19: [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 ((audio_fd=open(DEVICE_NAME, O_WRONLY /*| O_NONBLOCK*/, 0)) == -1) { data/modplugtools-0.5.3/mpplay/modplugplay.c:677:8: [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(status+4,"loop",4); data/modplugtools-0.5.3/mpplay/modplugplay.c:679:8: [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(status+4,"play",4); data/modplugtools-0.5.3/mpplay/modplugplay.c:696:8: [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(notpaus,status+4,4); data/modplugtools-0.5.3/mpplay/modplugplay.c:697:8: [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(status+4,"paus",4); data/modplugtools-0.5.3/mpplay/modplugplay.c:700:8: [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(status+4,notpaus,4); data/modplugtools-0.5.3/mp123/modplug123.c:374: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). if (strlen(songname)==0) { data/modplugtools-0.5.3/mp123/modplug123.c:375:17: [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 l = strlen(filename); data/modplugtools-0.5.3/mp123/modplug123.c:378:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(songname,st,41); data/modplugtools-0.5.3/mp123/modplug123.c:422:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(0, buffer, 1); /* s/nread/1/2 */ data/modplugtools-0.5.3/mpplay/modplugplay.c:443: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). if (strlen(songname)==0) { data/modplugtools-0.5.3/mpplay/modplugplay.c:444:17: [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 l = strlen(argv[song]); data/modplugtools-0.5.3/mpplay/modplugplay.c:447:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(songname,st,41); data/modplugtools-0.5.3/mpplay/modplugplay.c:491:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(0, buffer, 1); /* s/nread/1/2 */ ANALYSIS SUMMARY: Hits = 50 Lines analyzed = 1299 in approximately 0.05 seconds (27193 lines/second) Physical Source Lines of Code (SLOC) = 793 Hits@level = [0] 55 [1] 8 [2] 28 [3] 6 [4] 8 [5] 0 Hits@level+ = [0+] 105 [1+] 50 [2+] 42 [3+] 14 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 132.409 [1+] 63.0517 [2+] 52.9634 [3+] 17.6545 [4+] 10.0883 [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.