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/libmikmod-3.3.11.1/playercode/mplayer.c Examining data/libmikmod-3.3.11.1/playercode/sloader.c Examining data/libmikmod-3.3.11.1/playercode/mdulaw.c Examining data/libmikmod-3.3.11.1/playercode/mwav.c Examining data/libmikmod-3.3.11.1/playercode/mloader.c Examining data/libmikmod-3.3.11.1/playercode/virtch2.c Examining data/libmikmod-3.3.11.1/playercode/munitrk.c Examining data/libmikmod-3.3.11.1/playercode/virtch.c Examining data/libmikmod-3.3.11.1/playercode/npertab.c Examining data/libmikmod-3.3.11.1/playercode/mlutil.c Examining data/libmikmod-3.3.11.1/playercode/mlreg.c Examining data/libmikmod-3.3.11.1/playercode/virtch_common.c Examining data/libmikmod-3.3.11.1/playercode/mdriver.c Examining data/libmikmod-3.3.11.1/playercode/mdreg.c Examining data/libmikmod-3.3.11.1/android/config.h Examining data/libmikmod-3.3.11.1/macosx/config.h Examining data/libmikmod-3.3.11.1/macosx/ppc_intrinsics.h Examining data/libmikmod-3.3.11.1/drivers/drv_ds.c Examining data/libmikmod-3.3.11.1/drivers/drv_psp.c Examining data/libmikmod-3.3.11.1/drivers/drv_nos.c Examining data/libmikmod-3.3.11.1/drivers/drv_ahi.c Examining data/libmikmod-3.3.11.1/drivers/drv_stdout.c Examining data/libmikmod-3.3.11.1/drivers/drv_ultra.c Examining data/libmikmod-3.3.11.1/drivers/drv_wav.c Examining data/libmikmod-3.3.11.1/drivers/drv_osles.c Examining data/libmikmod-3.3.11.1/drivers/drv_aiff.c Examining data/libmikmod-3.3.11.1/drivers/drv_oss.c Examining data/libmikmod-3.3.11.1/drivers/drv_wss.c Examining data/libmikmod-3.3.11.1/drivers/drv_dart.c Examining data/libmikmod-3.3.11.1/drivers/drv_pipe.c Examining data/libmikmod-3.3.11.1/drivers/drv_openal.c Examining data/libmikmod-3.3.11.1/drivers/drv_AF.c Examining data/libmikmod-3.3.11.1/drivers/drv_hp.c Examining data/libmikmod-3.3.11.1/drivers/drv_nas.c Examining data/libmikmod-3.3.11.1/drivers/drv_sndio.c Examining data/libmikmod-3.3.11.1/drivers/drv_gp32.c Examining data/libmikmod-3.3.11.1/drivers/drv_os2.c Examining data/libmikmod-3.3.11.1/drivers/drv_sgi.c Examining data/libmikmod-3.3.11.1/drivers/dos/libgus.h Examining data/libmikmod-3.3.11.1/drivers/dos/dosgus.h Examining data/libmikmod-3.3.11.1/drivers/dos/dosirq.h Examining data/libmikmod-3.3.11.1/drivers/dos/doswss.h Examining data/libmikmod-3.3.11.1/drivers/dos/dosirq.c Examining data/libmikmod-3.3.11.1/drivers/dos/dossb.h Examining data/libmikmod-3.3.11.1/drivers/dos/dosdma.h Examining data/libmikmod-3.3.11.1/drivers/dos/dosdma.c Examining data/libmikmod-3.3.11.1/drivers/dos/dosgus.c Examining data/libmikmod-3.3.11.1/drivers/dos/dossb.c Examining data/libmikmod-3.3.11.1/drivers/dos/doswss.c Examining data/libmikmod-3.3.11.1/drivers/drv_sam9407.c Examining data/libmikmod-3.3.11.1/drivers/drv_sb.c Examining data/libmikmod-3.3.11.1/drivers/drv_pulseaudio.c Examining data/libmikmod-3.3.11.1/drivers/drv_sdl.c Examining data/libmikmod-3.3.11.1/drivers/drv_win.c Examining data/libmikmod-3.3.11.1/drivers/drv_raw.c Examining data/libmikmod-3.3.11.1/drivers/drv_xaudio2.c Examining data/libmikmod-3.3.11.1/drivers/drv_osx.c Examining data/libmikmod-3.3.11.1/drivers/drv_dc.c Examining data/libmikmod-3.3.11.1/drivers/drv_sun.c Examining data/libmikmod-3.3.11.1/drivers/drv_esd.c Examining data/libmikmod-3.3.11.1/drivers/drv_mac.c Examining data/libmikmod-3.3.11.1/drivers/drv_alsa.c Examining data/libmikmod-3.3.11.1/drivers/drv_aix.c Examining data/libmikmod-3.3.11.1/depackers/s404.c Examining data/libmikmod-3.3.11.1/depackers/pp20.c Examining data/libmikmod-3.3.11.1/depackers/xpk.c Examining data/libmikmod-3.3.11.1/depackers/mmcmp.c Examining data/libmikmod-3.3.11.1/posix/strstr.c Examining data/libmikmod-3.3.11.1/posix/strcasecmp.c Examining data/libmikmod-3.3.11.1/posix/memcmp.c Examining data/libmikmod-3.3.11.1/mmio/mmio.c Examining data/libmikmod-3.3.11.1/mmio/mmerror.c Examining data/libmikmod-3.3.11.1/mmio/mmalloc.c Examining data/libmikmod-3.3.11.1/dos/config.h Examining data/libmikmod-3.3.11.1/dlapi/dl_hpux.c Examining data/libmikmod-3.3.11.1/dlapi/dlfcn.h Examining data/libmikmod-3.3.11.1/psp/example.c Examining data/libmikmod-3.3.11.1/loaders/load_gdm.c Examining data/libmikmod-3.3.11.1/loaders/load_asy.c Examining data/libmikmod-3.3.11.1/loaders/load_ult.c Examining data/libmikmod-3.3.11.1/loaders/load_s3m.c Examining data/libmikmod-3.3.11.1/loaders/load_dsm.c Examining data/libmikmod-3.3.11.1/loaders/load_it.c Examining data/libmikmod-3.3.11.1/loaders/load_stm.c Examining data/libmikmod-3.3.11.1/loaders/load_umx.c Examining data/libmikmod-3.3.11.1/loaders/load_okt.c Examining data/libmikmod-3.3.11.1/loaders/load_far.c Examining data/libmikmod-3.3.11.1/loaders/load_amf.c Examining data/libmikmod-3.3.11.1/loaders/load_imf.c Examining data/libmikmod-3.3.11.1/loaders/load_xm.c Examining data/libmikmod-3.3.11.1/loaders/load_med.c Examining data/libmikmod-3.3.11.1/loaders/load_mod.c Examining data/libmikmod-3.3.11.1/loaders/load_uni.c Examining data/libmikmod-3.3.11.1/loaders/load_m15.c Examining data/libmikmod-3.3.11.1/loaders/load_669.c Examining data/libmikmod-3.3.11.1/loaders/load_mtm.c Examining data/libmikmod-3.3.11.1/loaders/load_gt2.c Examining data/libmikmod-3.3.11.1/loaders/load_stx.c Examining data/libmikmod-3.3.11.1/macintosh/config.h Examining data/libmikmod-3.3.11.1/macintosh/cwclassicheaders.h Examining data/libmikmod-3.3.11.1/macintosh/cwmikmodheaders.h Examining data/libmikmod-3.3.11.1/macintosh/mpwmikmodheaders.h Examining data/libmikmod-3.3.11.1/macintosh/cwcarbonheaders.h Examining data/libmikmod-3.3.11.1/include/mikmod_ctype.h Examining data/libmikmod-3.3.11.1/include/mikmod.h Examining data/libmikmod-3.3.11.1/include/mikmod_internals.h Examining data/libmikmod-3.3.11.1/examples/simpleplayMEM2/splayMEM2.c Examining data/libmikmod-3.3.11.1/examples/simpleplayFP/splayFP.c Examining data/libmikmod-3.3.11.1/examples/simpleplay/splay.c Examining data/libmikmod-3.3.11.1/examples/soundeffects/soundeffects.c Examining data/libmikmod-3.3.11.1/examples/simpleplayMEM/myloader.h Examining data/libmikmod-3.3.11.1/examples/simpleplayMEM/splayMEM.c Examining data/libmikmod-3.3.11.1/examples/simpleplayMEM/myloader.c Examining data/libmikmod-3.3.11.1/examples/amiga.c Examining data/libmikmod-3.3.11.1/examples/test/test.c FINAL RESULTS: data/libmikmod-3.3.11.1/depackers/mmcmp.c:47:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/depackers/pp20.c:57:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/depackers/s404.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/depackers/xpk.c:64:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:60:26: [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. # define DEBUG_PRINT(x) printf x; data/libmikmod-3.3.11.1/drivers/drv_alsa.c:119:21: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define dbgprint fprintf data/libmikmod-3.3.11.1/drivers/drv_oss.c:151:6: [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. if(!access(sounddevice,F_OK)) data/libmikmod-3.3.11.1/drivers/drv_oss.c:159:6: [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. if(access("/dev/dsp0",F_OK)) data/libmikmod-3.3.11.1/drivers/drv_pipe.c:97:13: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. pipefile = popen(target, "wb"); data/libmikmod-3.3.11.1/drivers/drv_pipe.c:123:5: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl("/bin/sh","sh","-c",target,NULL); data/libmikmod-3.3.11.1/drivers/drv_sun.c:198:11: [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(getenv("AUDIODEV"), W_OK) == 0); data/libmikmod-3.3.11.1/drivers/drv_sun.c:200:7: [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. if (access(SOUNDDEVICE, W_OK) == 0) data/libmikmod-3.3.11.1/drivers/drv_sun.c:205:7: [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. if (access(SOUNDDEVICE "0", W_OK) == 0) data/libmikmod-3.3.11.1/drivers/drv_xaudio2.c:75:22: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define dbgprintf fprintf data/libmikmod-3.3.11.1/loaders/load_669.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_amf.c:44:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_dsm.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_far.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_gdm.c:54:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_imf.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_it.c:47:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_m15.c:48:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_med.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_mod.c:47:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_mtm.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_okt.c:53:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_s3m.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_stm.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_stx.c:52:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_ult.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_umx.c:231:2: [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(out, (hdr->file_version >= 64)? &buf[1] : buf); data/libmikmod-3.3.11.1/loaders/load_uni.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_uni.c:584:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modtype,"%s (was %s)",(universion>=0x100)?"APlayer":"MikCvt2",oldtype); data/libmikmod-3.3.11.1/loaders/load_uni.c:591:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modtype,"%s",(universion>=0x100)?"APlayer":"MikCvt3"); data/libmikmod-3.3.11.1/loaders/load_xm.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/loaders/load_xm.c:720:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modtype,"%s (XM format %d.%02d)", data/libmikmod-3.3.11.1/mmio/mmalloc.c:138:9: [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). if (d) strcpy(d, s); data/libmikmod-3.3.11.1/playercode/mdriver.c:45:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/playercode/mdriver.c:198:19: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. list_end += sprintf(list_end, "%2d %s%s", t, l->Version, (l->next)? "\n" : ""); data/libmikmod-3.3.11.1/playercode/mloader.c:45:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/playercode/mloader.c:83:19: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. list_end += sprintf(list_end, "%s%s", l->version, (l->next) ? "\n" : ""); data/libmikmod-3.3.11.1/playercode/mlutil.c:41:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/playercode/mplayer.c:46:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/playercode/mwav.c:45:12: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern int fprintf(FILE *, const char *, ...); data/libmikmod-3.3.11.1/psp/example.c:18: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. #define printf pspDebugScreenPrintf data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:720:17: [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. char *gusenv = getenv("ULTRASND"); data/libmikmod-3.3.11.1/drivers/dos/dossb.c:296:8: [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. env = getenv("BLASTER"); data/libmikmod-3.3.11.1/drivers/dos/doswss.c:325:8: [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. env = getenv("WSS"); data/libmikmod-3.3.11.1/drivers/drv_oss.c:288:36: [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. if((fragsize==DEFAULT_FRAGSIZE)&&(getenv("MM_FRAGSIZE"))) { data/libmikmod-3.3.11.1/drivers/drv_oss.c:289:17: [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. fragsize=atoi(getenv("MM_FRAGSIZE")); data/libmikmod-3.3.11.1/drivers/drv_oss.c:292:36: [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. if((numfrags==DEFAULT_NUMFRAGS)&&(getenv("MM_NUMFRAGS"))) { data/libmikmod-3.3.11.1/drivers/drv_oss.c:293:17: [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. numfrags=atoi(getenv("MM_NUMFRAGS")); data/libmikmod-3.3.11.1/drivers/drv_sgi.c:157:7: [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. if ((getenv("MM_SGI_FRAGSIZE"))&&(sgi_fragsize!=DEFAULT_SGI_FRAGSIZE)) data/libmikmod-3.3.11.1/drivers/drv_sgi.c:158:21: [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. sgi_fragsize=atol(getenv("MM_SGI_FRAGSIZE")); data/libmikmod-3.3.11.1/drivers/drv_sgi.c:160:7: [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. if ((getenv("MM_SGI_BUFSIZE"))&&(sgi_bufsize!=DEFAULT_SGI_BUFSIZE)) data/libmikmod-3.3.11.1/drivers/drv_sgi.c:161:20: [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. sgi_bufsize=atol(getenv("MM_SGI_BUFSIZE")); data/libmikmod-3.3.11.1/drivers/drv_sun.c:197:6: [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. if (getenv("AUDIODEV")) data/libmikmod-3.3.11.1/drivers/drv_sun.c:198:18: [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. return (access(getenv("AUDIODEV"), W_OK) == 0); data/libmikmod-3.3.11.1/drivers/drv_sun.c:222:6: [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. if (getenv("AUDIODEV")) data/libmikmod-3.3.11.1/drivers/drv_sun.c:223:16: [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. sndfd = open(getenv("AUDIODEV"), O_WRONLY); data/libmikmod-3.3.11.1/playercode/mplayer.c:47:17: [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. extern long int random(void); data/libmikmod-3.3.11.1/playercode/mplayer.c:233:9: [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. return random()&(ceilval-1); data/libmikmod-3.3.11.1/depackers/xpk.c:333: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(bc, c + packed_size, 3); data/libmikmod-3.3.11.1/depackers/xpk.c:336: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(c + packed_size, bc, 3); data/libmikmod-3.3.11.1/depackers/xpk.c:344:4: [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(io.dest, c, packed_size); data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:361:18: [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 unsigned char irqctl[16] = { 0, 0, 1, 3, 0, 2, 0, 4, 0, 0, 0, 5, 6, 0, 0, 7 }; data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:362:18: [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 unsigned char dmactl[8] = { 0, 1, 0, 2, 0, 3, 4, 5 }; data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:932:11: [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 (!gus.open) data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:950:11: [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 (!gus.open) data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:968:11: [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 (!gus.open) data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:1010:11: [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 (!gus.open || !size || (bits16 && size > 0x40000)) data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:1245:53: [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 (!instrument || !instrument->info.layer || !gus.open) data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:1343:2: [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((char *)info->id, "gus0"); data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:1367:21: [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 (!gus.ok || gus.open || card != 0) data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:1450:11: [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 (!gus.open || card != 0) data/libmikmod-3.3.11.1/drivers/dos/dosgus.c:1484:11: [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 (!gus.open || (card != 0)) data/libmikmod-3.3.11.1/drivers/dos/dosgus.h:335:10: [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). boolean open; /* 1 if between gus_open() and gus_close() */ data/libmikmod-3.3.11.1/drivers/dos/dosirq.c:112:2: [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(tmp, irqtpl, irqend - irqtpl); data/libmikmod-3.3.11.1/drivers/dos/dossb.c:384:9: [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 (sb.open) data/libmikmod-3.3.11.1/drivers/dos/dossb.c:414:10: [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 (!sb.open) data/libmikmod-3.3.11.1/drivers/dos/dossb.h:214:10: [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). boolean open; /* Whenever the card has been opened */ data/libmikmod-3.3.11.1/drivers/dos/doswss.c:390:10: [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 (wss.open) data/libmikmod-3.3.11.1/drivers/dos/doswss.c:421:11: [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 (!wss.open) data/libmikmod-3.3.11.1/drivers/dos/doswss.h:148:10: [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). boolean open; /* Whenever the card has been opened */ data/libmikmod-3.3.11.1/drivers/dos/libgus.h:64:11: [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 id[8]; /* id of this card (warning! maybe unterminated!!!) */ data/libmikmod-3.3.11.1/drivers/dos/libgus.h:173: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 envelope_rate[6]; data/libmikmod-3.3.11.1/drivers/dos/libgus.h:174: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 envelope_offset[6]; data/libmikmod-3.3.11.1/drivers/drv_aiff.c:191:23: [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). if (!(gAiffFile = fopen (gAiffFileName ? gAiffFileName : AIFF_FILENAME, "wb"))) data/libmikmod-3.3.11.1/drivers/drv_aix.c:63:11: [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). int buf=atoi(buffer); data/libmikmod-3.3.11.1/drivers/drv_aix.c:76:9: [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((fd=open("/dev/acpa0/1",O_WRONLY))<0) data/libmikmod-3.3.11.1/drivers/drv_aix.c:77:10: [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((fd=open("/dev/paud0/1",O_WRONLY))<0) data/libmikmod-3.3.11.1/drivers/drv_aix.c:78:11: [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((fd=open("/dev/baud0/1",O_WRONLY))<0) data/libmikmod-3.3.11.1/drivers/drv_aix.c:96:9: [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((fd=open("/dev/acpa0/1",O_WRONLY))<0) data/libmikmod-3.3.11.1/drivers/drv_aix.c:97:10: [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((fd=open("/dev/paud0/1",O_WRONLY))<0) data/libmikmod-3.3.11.1/drivers/drv_aix.c:98:11: [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((fd=open("/dev/baud0/1",O_WRONLY))<0) { data/libmikmod-3.3.11.1/drivers/drv_dart.c:72:9: [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). buf = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_dart.c:79:9: [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). buf = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_dart.c:86:9: [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). buf = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_ds.c:148:11: [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). int buf=atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_hp.c:64:11: [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). int buf=atoi(buffer); data/libmikmod-3.3.11.1/drivers/drv_hp.c:84:9: [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((fd=open("/dev/audio",O_WRONLY))>=0) { data/libmikmod-3.3.11.1/drivers/drv_hp.c:100:10: [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 ((fd=open("/dev/audio",O_WRONLY|O_NDELAY,0))<0) { data/libmikmod-3.3.11.1/drivers/drv_nas.c:375:14: [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). long v = atol (p); data/libmikmod-3.3.11.1/drivers/drv_nas.c:381:14: [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). long v = atol (p); data/libmikmod-3.3.11.1/drivers/drv_openal.c:142:17: [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). buffer_size = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_openal.c:154:18: [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). buffer_queue = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_os2.c:122:9: [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). buf = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_os2.c:128:9: [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). buf = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_oss.c:125:12: [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). fragsize=atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_oss.c:130:12: [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). numfrags=atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_oss.c:136:10: [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). card = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_oss.c:144: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. static char sounddevice[20]; data/libmikmod-3.3.11.1/drivers/drv_oss.c:148: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(sounddevice,"/dev/sound/dsp%d",card); data/libmikmod-3.3.11.1/drivers/drv_oss.c:150:3: [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(sounddevice,"/dev/sound/dsp"); data/libmikmod-3.3.11.1/drivers/drv_oss.c:154:2: [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(sounddevice,"/dev/dsp%d",card); data/libmikmod-3.3.11.1/drivers/drv_oss.c:160: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(sounddevice,"/dev/dsp"); data/libmikmod-3.3.11.1/drivers/drv_oss.c:173:9: [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((fd=open(OSS_GetDeviceName(),O_WRONLY|O_NONBLOCK))>=0) { data/libmikmod-3.3.11.1/drivers/drv_oss.c:282:12: [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((sndfd=open(OSS_GetDeviceName(),O_WRONLY))<0) { data/libmikmod-3.3.11.1/drivers/drv_oss.c:289:12: [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). fragsize=atoi(getenv("MM_FRAGSIZE")); data/libmikmod-3.3.11.1/drivers/drv_oss.c:293:12: [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). numfrags=atoi(getenv("MM_NUMFRAGS")); data/libmikmod-3.3.11.1/drivers/drv_osx.c:141:17: [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 unsigned char *gSoundBackBuffer[NUMBER_BACK_BUFFERS]; data/libmikmod-3.3.11.1/drivers/drv_raw.c:79: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). rawout=fopen(filename?filename:FILENAME,"wb"); data/libmikmod-3.3.11.1/drivers/drv_raw.c:121: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). rawout=fopen(filename?filename:FILENAME,"wb"); data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:108: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). card=atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:116: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 devName[256]; data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:118:2: [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(devName, "/dev/sam%d_mod", card); data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:119:9: [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((fd=open(devName, O_RDWR))>=0) { data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:228: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 devName[256]; data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:231:2: [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(devName, "/dev/sam%d_mod", card); data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:232:12: [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((modfd=open(devName, O_RDWR))<0) { data/libmikmod-3.3.11.1/drivers/drv_sgi.c:77:16: [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). sgi_fragsize=atol(ptr); data/libmikmod-3.3.11.1/drivers/drv_sgi.c:82:15: [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). sgi_bufsize=atol(ptr); data/libmikmod-3.3.11.1/drivers/drv_sgi.c:158:16: [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). sgi_fragsize=atol(getenv("MM_SGI_FRAGSIZE")); data/libmikmod-3.3.11.1/drivers/drv_sgi.c:161:15: [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). sgi_bufsize=atol(getenv("MM_SGI_BUFSIZE")); data/libmikmod-3.3.11.1/drivers/drv_sndio.c:65:11: [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). int n = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_sun.c:178: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). int buf = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_sun.c:223:11: [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). sndfd = open(getenv("AUDIODEV"), O_WRONLY); data/libmikmod-3.3.11.1/drivers/drv_sun.c:225:11: [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). sndfd = open(SOUNDDEVICE, O_WRONLY); data/libmikmod-3.3.11.1/drivers/drv_sun.c:228:12: [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). sndfd = open(SOUNDDEVICE "0", O_WRONLY); data/libmikmod-3.3.11.1/drivers/drv_ultra.c:413: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). int buf = atoi(ptr); data/libmikmod-3.3.11.1/drivers/drv_ultra.c:422:18: [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). gus_dma_usage (atoi(ptr)); data/libmikmod-3.3.11.1/drivers/drv_wav.c:121: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). if(!(wavfile=fopen(filename?filename:FILENAME,"wb"))) { data/libmikmod-3.3.11.1/examples/simpleplayFP/splayFP.c:57: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). fptr = fopen(argv[1], "rb"); data/libmikmod-3.3.11.1/examples/simpleplayMEM/splayMEM.c:66: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). fptr = fopen(argv[1], "rb"); data/libmikmod-3.3.11.1/examples/simpleplayMEM2/splayMEM2.c:63: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). fptr = fopen(argv[1], "rb"); data/libmikmod-3.3.11.1/examples/soundeffects/soundeffects.c:33: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). fptr = fopen(fn, "rb"); data/libmikmod-3.3.11.1/loaders/load_amf.c:157: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(track+row,track+(row+arg),sizeof(AMFNOTE)); data/libmikmod-3.3.11.1/loaders/load_dsm.c:104:23: [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 const unsigned char DSMSIG[4+4]={'R','I','F','F','D','S','M','F'}; data/libmikmod-3.3.11.1/loaders/load_far.c:95:23: [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 const unsigned char FARSIG[4+3]={'F','A','R',0xfe,13,10,26}; data/libmikmod-3.3.11.1/loaders/load_gdm.c:206:4: [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(gdmbuf+(64U*ch)+pos,&n,sizeof(GDMNOTE)); data/libmikmod-3.3.11.1/loaders/load_it.c:573:2: [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(of.chanvol,mh->voltable,64); data/libmikmod-3.3.11.1/loaders/load_m15.c:82: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. static const char *signatures[REJECT]={ data/libmikmod-3.3.11.1/loaders/load_umx.c:146: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 sig[16]; data/libmikmod-3.3.11.1/loaders/load_umx.c:191: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 buf[40]; data/libmikmod-3.3.11.1/loaders/load_umx.c:214: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 buf[64]; data/libmikmod-3.3.11.1/loaders/load_umx.c:241: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 buf[64]; data/libmikmod-3.3.11.1/loaders/load_umx.c:331: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 header[UPKG_HDR_SIZE]; data/libmikmod-3.3.11.1/loaders/load_uni.c:113: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[6]; data/libmikmod-3.3.11.1/loaders/load_xm.c:675: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 tracker[21],modtype[60]; data/libmikmod-3.3.11.1/loaders/load_xm.c:714:3: [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(tracker,"Unknown tracker"); data/libmikmod-3.3.11.1/mmio/mmerror.c:45: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. static const char *_mm_errmsg[MMERR_MAX+1] = data/libmikmod-3.3.11.1/mmio/mmio.c:83:10: [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). if(!(fp=fopen(fname,attrib))) { data/libmikmod-3.3.11.1/mmio/mmio.c:94:10: [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). if(!(fp=fopen(fname,"r"))) return 0; data/libmikmod-3.3.11.1/playercode/mdulaw.c:51:23: [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 const unsigned char ulaw_comp_table[16384] = { data/libmikmod-3.3.11.1/playercode/mloader.c:158: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(p, buf + fpos, cnt); data/libmikmod-3.3.11.1/playercode/mloader.c:585:2: [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(mf,&of,sizeof(MODULE)); data/libmikmod-3.3.11.1/playercode/munitrk.c:284:2: [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,unibuf,unipc); data/libmikmod-3.3.11.1/dlapi/dl_hpux.c:40: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). library[strlen(library) - 1] = 'l'; data/libmikmod-3.3.11.1/drivers/drv_sam9407.c:382:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(read(modfd, &event, sizeof(event))>0 && (long)event.echo.closure!=ticker_idx); data/libmikmod-3.3.11.1/examples/simpleplay/splay.c:21:26: [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. #define MikMod_Sleep(ns) usleep(ns) data/libmikmod-3.3.11.1/examples/simpleplayFP/splayFP.c:22:26: [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. #define MikMod_Sleep(ns) usleep(ns) data/libmikmod-3.3.11.1/examples/simpleplayMEM/splayMEM.c:24:26: [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. #define MikMod_Sleep(ns) usleep(ns) data/libmikmod-3.3.11.1/examples/simpleplayMEM2/splayMEM2.c:24:26: [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. #define MikMod_Sleep(ns) usleep(ns) data/libmikmod-3.3.11.1/examples/soundeffects/soundeffects.c:23:26: [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. #define MikMod_Sleep(ns) usleep(ns) data/libmikmod-3.3.11.1/loaders/load_669.c:297:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(of.comment,mh->message,36); data/libmikmod-3.3.11.1/loaders/load_669.c:298: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(of.comment,"\r"); data/libmikmod-3.3.11.1/loaders/load_669.c:299:25: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. if (mh->message[36]) strncat(of.comment,mh->message+36,36); data/libmikmod-3.3.11.1/loaders/load_669.c:300: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(of.comment,"\r"); data/libmikmod-3.3.11.1/loaders/load_669.c:301:25: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. if (mh->message[72]) strncat(of.comment,mh->message+72,36); data/libmikmod-3.3.11.1/loaders/load_669.c:302: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(of.comment,"\r"); data/libmikmod-3.3.11.1/loaders/load_umx.c:226:15: [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). l += (long)strlen(buf); data/libmikmod-3.3.11.1/loaders/load_uni.c:579: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). size_t len=strlen(oldtype)+20; data/libmikmod-3.3.11.1/loaders/load_xm.c:709:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tracker,mh->trackername,20);tracker[20]=0; data/libmikmod-3.3.11.1/mmio/mmalloc.c:136:6: [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). l = strlen(s) + 1; data/libmikmod-3.3.11.1/mmio/mmio.c:65:12: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). extern int fgetc(FILE *); data/libmikmod-3.3.11.1/mmio/mmio.c:137:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return fgetc(((MFILEREADER*)reader)->file); data/libmikmod-3.3.11.1/mmio/mmio.c:345: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). _mm_write_UBYTES(data,strlen(data),writer); data/libmikmod-3.3.11.1/playercode/mdriver.c:190: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). len += 4 + (l->next ? 1 : 0) + strlen(l->Version); data/libmikmod-3.3.11.1/playercode/mdriver.c:895: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). const CHAR *ptr=buf+strlen(atomname); data/libmikmod-3.3.11.1/playercode/mdriver.c:901:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ret,buf,ptr-buf); data/libmikmod-3.3.11.1/playercode/mdriver.c:906:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ret,buf,ptr-buf); data/libmikmod-3.3.11.1/playercode/mloader.c:75: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). len += 1 + (l->next ? 1 : 0) + strlen(l->version); data/libmikmod-3.3.11.1/posix/strstr.c:14: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). len = strlen(needle); ANALYSIS SUMMARY: Hits = 193 Lines analyzed = 46923 in approximately 1.44 seconds (32484 lines/second) Physical Source Lines of Code (SLOC) = 34479 Hits@level = [0] 94 [1] 26 [2] 105 [3] 17 [4] 45 [5] 0 Hits@level+ = [0+] 287 [1+] 193 [2+] 167 [3+] 62 [4+] 45 [5+] 0 Hits/KSLOC@level+ = [0+] 8.32391 [1+] 5.59761 [2+] 4.84353 [3+] 1.7982 [4+] 1.30514 [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.