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/sidplay-base-1.0.9/audio/linux-pcsnd/audiodrv.h Examining data/sidplay-base-1.0.9/audio/linux-pcsnd/audiodrv.cpp Examining data/sidplay-base-1.0.9/audio/hpux/audiodrv.h Examining data/sidplay-base-1.0.9/audio/hpux/audiodrv.cpp Examining data/sidplay-base-1.0.9/audio/sgi/audiodrv.h Examining data/sidplay-base-1.0.9/audio/sgi/audiodrv.cpp Examining data/sidplay-base-1.0.9/audio/sparc/audiodrv.h Examining data/sidplay-base-1.0.9/audio/sparc/audiodrv.cpp Examining data/sidplay-base-1.0.9/audio/oss/audiodrv.h Examining data/sidplay-base-1.0.9/audio/oss/audiodrv.cpp Examining data/sidplay-base-1.0.9/sid2wav.cpp Examining data/sidplay-base-1.0.9/sidcon.cpp Examining data/sidplay-base-1.0.9/sidplay.cpp FINAL RESULTS: data/sidplay-base-1.0.9/audio/hpux/audiodrv.cpp:23:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return (access(AUDIODEVICE,W_OK)==0); data/sidplay-base-1.0.9/audio/linux-pcsnd/audiodrv.cpp:23:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return (access(AUDIODEVICE,W_OK)==0); data/sidplay-base-1.0.9/audio/oss/audiodrv.cpp:30:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return (access(AUDIODEVICE,W_OK)==0); data/sidplay-base-1.0.9/audio/sgi/audiodrv.cpp:21:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return (access(AUDIODEVICE,W_OK)==0); data/sidplay-base-1.0.9/audio/sparc/audiodrv.cpp:23:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return (access(AUDIODEVICE,W_OK)==0); data/sidplay-base-1.0.9/sid2wav.cpp:365: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(waveFileName, argv[outfile]); data/sidplay-base-1.0.9/sid2wav.cpp:372: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(waveFileName,argv[infile]); data/sidplay-base-1.0.9/sid2wav.cpp:385: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(waveFileName,argv[outfile]); data/sidplay-base-1.0.9/sidcon.cpp:202:17: [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(outFileName,mySTI.path); data/sidplay-base-1.0.9/sidcon.cpp:203:17: [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(outFileName,mySTI.dataFileName); data/sidplay-base-1.0.9/sidcon.cpp:211: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(tmpDataName,mySTI.path); data/sidplay-base-1.0.9/sidcon.cpp:212:5: [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(tmpDataName,tmp); data/sidplay-base-1.0.9/sidcon.cpp:216: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(tmpInfoName,mySTI.path); data/sidplay-base-1.0.9/sidcon.cpp:217:5: [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(tmpInfoName,tmp); data/sidplay-base-1.0.9/sidcon.cpp:225:13: [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(outFileName,mySTI.path); data/sidplay-base-1.0.9/sidcon.cpp:226:13: [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(outFileName,mySTI.infoFileName); data/sidplay-base-1.0.9/sidcon.cpp:306: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(file,path); data/sidplay-base-1.0.9/sidcon.cpp:308:3: [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(file,entry->d_name); data/sidplay-base-1.0.9/sidcon.cpp:320:4: [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(newPath,path); data/sidplay-base-1.0.9/sidcon.cpp:322:4: [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(newPath,entry->d_name); data/sidplay-base-1.0.9/sidcon.cpp:209:35: [3] (tmpfile) tmpnam: Temporary file race condition (CWE-377). char* tmp = fileNameWithoutPath(tmpnam(NULL)); data/sidplay-base-1.0.9/sidcon.cpp:214:29: [3] (tmpfile) tmpnam: Temporary file race condition (CWE-377). tmp = fileNameWithoutPath(tmpnam(NULL)); data/sidplay-base-1.0.9/audio/hpux/audiodrv.cpp:29:15: [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 ((audioHd=open(AUDIODEVICE,O_WRONLY,0)) == (-1)) data/sidplay-base-1.0.9/audio/linux-pcsnd/audiodrv.cpp:29:15: [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 ((audioHd=open(AUDIODEVICE,O_WRONLY,0)) == (-1)) data/sidplay-base-1.0.9/audio/oss/audiodrv.cpp:36:15: [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 ((audioHd=open(AUDIODEVICE,O_WRONLY,0)) == (-1)) data/sidplay-base-1.0.9/audio/sparc/audiodrv.cpp:29:15: [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 ((audioHd=open(AUDIODEVICE,O_WRONLY,0)) == (-1)) data/sidplay-base-1.0.9/sid2wav.cpp:48:2: [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 main_chunk[4]; // 'RIFF' data/sidplay-base-1.0.9/sid2wav.cpp:50:2: [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 chunk_type[4]; // 'WAVE' data/sidplay-base-1.0.9/sid2wav.cpp:52:2: [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 sub_chunk[4]; // 'fmt ' data/sidplay-base-1.0.9/sid2wav.cpp:60:2: [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 data_chunk[4]; // keyword, begin of data chunk; = 'data' data/sidplay-base-1.0.9/sid2wav.cpp:66:2: [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 id[4]; // '.snd' data/sidplay-base-1.0.9/sid2wav.cpp:231:23: [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). fadeOut.seconds = atoi(argv[a]+5); data/sidplay-base-1.0.9/sid2wav.cpp:235:22: [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). fadeIn.seconds = atoi(argv[a]+4); data/sidplay-base-1.0.9/sid2wav.cpp:255:21: [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). secondsToSkip = atoi(argv[a]+2); data/sidplay-base-1.0.9/sid2wav.cpp:259:36: [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). myEmuConfig.frequency = (ulong)atoi(argv[a]+2); data/sidplay-base-1.0.9/sid2wav.cpp:283:20: [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). selectedSong = atoi(argv[a]+2); data/sidplay-base-1.0.9/sid2wav.cpp:287:15: [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). seconds = atoi(argv[a]+2); data/sidplay-base-1.0.9/sid2wav.cpp:349:2: [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 waveFileName[MAXPATH]; data/sidplay-base-1.0.9/sid2wav.cpp:352: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 indrive[MAXDRIVE], inpath[MAXDIR], inname[MAXFILE], inext[MAXEXT]; data/sidplay-base-1.0.9/sid2wav.cpp:375:4: [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(fileExtOfPath(waveFileName),".au"); data/sidplay-base-1.0.9/sid2wav.cpp:379:4: [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(fileExtOfPath(waveFileName),".wav"); data/sidplay-base-1.0.9/sidcon.cpp:242:13: [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(fileExtOfPath(outFileName),".sid"); data/sidplay-base-1.0.9/sidcon.cpp:247:13: [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(fileExtOfPath(outFileName),".c64"); data/sidplay-base-1.0.9/sidcon.cpp:249:13: [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(fileExtOfPath(outFileName),".sid"); data/sidplay-base-1.0.9/sidplay.cpp:185:28: [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). fragments = (unsigned)atoi(argv[a]+3); data/sidplay-base-1.0.9/sidplay.cpp:191:31: [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). fragSizeBase = (unsigned)atoi(argv[a]+3); data/sidplay-base-1.0.9/sidplay.cpp:197:21: [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). forceBufSize = atoi(argv[a]+2); data/sidplay-base-1.0.9/sidplay.cpp:204:37: [2] (integer) atol: 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). myEmuConfig.frequency = (udword)atol(argv[a]+2); data/sidplay-base-1.0.9/sidplay.cpp:218:20: [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). selectedSong = atoi(argv[a]+2); data/sidplay-base-1.0.9/sidplay.cpp:532:8: [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). t = atoi(arg); data/sidplay-base-1.0.9/sid2wav.cpp:215: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(argv[a]) == 1 ) data/sidplay-base-1.0.9/sid2wav.cpp:267: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). for ( ubyte j = 2; j < strlen(argv[a]); j++ ) data/sidplay-base-1.0.9/sid2wav.cpp:371:27: [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). waveFileName = new char[strlen(argv[infile])+4+1]; data/sidplay-base-1.0.9/sid2wav.cpp:384:27: [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). waveFileName = new char[strlen(argv[outfile])+1]; data/sidplay-base-1.0.9/sidcon.cpp:199:52: [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). success &= (0!=(outFileName = new char[strlen(mySTI.path)+strlen(mySTI.dataFileName)+4+1])); data/sidplay-base-1.0.9/sidcon.cpp:199:71: [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). success &= (0!=(outFileName = new char[strlen(mySTI.path)+strlen(mySTI.dataFileName)+4+1])); data/sidplay-base-1.0.9/sidcon.cpp:210:34: [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). char* tmpDataName = new char[strlen(mySTI.path)+strlen(tmp)+1]; data/sidplay-base-1.0.9/sidcon.cpp:210:53: [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). char* tmpDataName = new char[strlen(mySTI.path)+strlen(tmp)+1]; data/sidplay-base-1.0.9/sidcon.cpp:215:34: [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). char* tmpInfoName = new char[strlen(mySTI.path)+strlen(tmp)+1]; data/sidplay-base-1.0.9/sidcon.cpp:215:53: [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). char* tmpInfoName = new char[strlen(mySTI.path)+strlen(tmp)+1]; data/sidplay-base-1.0.9/sidcon.cpp:305: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). char* file = new char[strlen(path)+strlen(entry->d_name)+1+1]; data/sidplay-base-1.0.9/sidcon.cpp:305: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). char* file = new char[strlen(path)+strlen(entry->d_name)+1+1]; data/sidplay-base-1.0.9/sidcon.cpp:307:3: [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(file,"/"); data/sidplay-base-1.0.9/sidcon.cpp:319: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). char* newPath = new char[strlen(path)+strlen(entry->d_name)+1+1]; data/sidplay-base-1.0.9/sidcon.cpp:319: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). char* newPath = new char[strlen(path)+strlen(entry->d_name)+1+1]; data/sidplay-base-1.0.9/sidcon.cpp:321:4: [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(newPath,"/"); data/sidplay-base-1.0.9/sidplay.cpp:152: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(argv[a]) == 1 ) ANALYSIS SUMMARY: Hits = 67 Lines analyzed = 3061 in approximately 0.10 seconds (31671 lines/second) Physical Source Lines of Code (SLOC) = 2377 Hits@level = [0] 0 [1] 17 [2] 28 [3] 2 [4] 20 [5] 0 Hits@level+ = [0+] 67 [1+] 67 [2+] 50 [3+] 22 [4+] 20 [5+] 0 Hits/KSLOC@level+ = [0+] 28.1868 [1+] 28.1868 [2+] 21.0349 [3+] 9.25536 [4+] 8.41397 [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.