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/mlton-20180207/doc/examples/finalizable/cons.c Examining data/mlton-20180207/doc/examples/ffi/ffi-import.c Examining data/mlton-20180207/doc/examples/ffi/c_quot.c Examining data/mlton-20180207/doc/examples/ffi/ffi-export.c Examining data/mlton-20180207/include/x86-main.h Examining data/mlton-20180207/include/c-main.h Examining data/mlton-20180207/include/mlton-main.h Examining data/mlton-20180207/include/common-main.h Examining data/mlton-20180207/include/c-chunk.h Examining data/mlton-20180207/include/amd64-main.h Examining data/mlton-20180207/include/c-common.h Examining data/mlton-20180207/lib/mlnlffi-lib/gen-rtld-flags.c Examining data/mlton-20180207/regression/library/libm3.c Examining data/mlton-20180207/regression/library/libm4.c Examining data/mlton-20180207/regression/library/libm5.c Examining data/mlton-20180207/regression/library/libm2.c Examining data/mlton-20180207/regression/library/check.c Examining data/mlton-20180207/regression/library/libm1.c Examining data/mlton-20180207/runtime/util.h Examining data/mlton-20180207/runtime/platform/setenv.putenv.c Examining data/mlton-20180207/runtime/platform/recv.nonblock.c Examining data/mlton-20180207/runtime/platform/freebsd.c Examining data/mlton-20180207/runtime/platform/nonwin.c Examining data/mlton-20180207/runtime/platform/hurd.h Examining data/mlton-20180207/runtime/platform/mingw.h Examining data/mlton-20180207/runtime/platform/float-math.h Examining data/mlton-20180207/runtime/platform/linux.h Examining data/mlton-20180207/runtime/platform/aix.h Examining data/mlton-20180207/runtime/platform/openbsd.c Examining data/mlton-20180207/runtime/platform/arm64.h Examining data/mlton-20180207/runtime/platform/solaris.c Examining data/mlton-20180207/runtime/platform/arm.h Examining data/mlton-20180207/runtime/platform/netbsd.c Examining data/mlton-20180207/runtime/platform/mips.h Examining data/mlton-20180207/runtime/platform/hurd.c Examining data/mlton-20180207/runtime/platform/sysctl.c Examining data/mlton-20180207/runtime/platform/ia64.h Examining data/mlton-20180207/runtime/platform/netbsd.h Examining data/mlton-20180207/runtime/platform/mingw.c Examining data/mlton-20180207/runtime/platform/powerpc.h Examining data/mlton-20180207/runtime/platform/powerpc64.h Examining data/mlton-20180207/runtime/platform/sysconf.c Examining data/mlton-20180207/runtime/platform/hppa.h Examining data/mlton-20180207/runtime/platform/darwin.h Examining data/mlton-20180207/runtime/platform/cygwin.c Examining data/mlton-20180207/runtime/platform/float-math.c Examining data/mlton-20180207/runtime/platform/alpha.h Examining data/mlton-20180207/runtime/platform/openbsd.h Examining data/mlton-20180207/runtime/platform/diskBack.unix.c Examining data/mlton-20180207/runtime/platform/mremap.c Examining data/mlton-20180207/runtime/platform/s390.h Examining data/mlton-20180207/runtime/platform/hpux.c Examining data/mlton-20180207/runtime/platform/mmap.c Examining data/mlton-20180207/runtime/platform/mmap-protect.c Examining data/mlton-20180207/runtime/platform/sparc.h Examining data/mlton-20180207/runtime/platform/displayMem.proc.c Examining data/mlton-20180207/runtime/platform/solaris.h Examining data/mlton-20180207/runtime/platform/use-mmap.c Examining data/mlton-20180207/runtime/platform/aix.c Examining data/mlton-20180207/runtime/platform/android_ucontext.h Examining data/mlton-20180207/runtime/platform/hpux.h Examining data/mlton-20180207/runtime/platform/m68k.h Examining data/mlton-20180207/runtime/platform/setenv.h Examining data/mlton-20180207/runtime/platform/cygwin.h Examining data/mlton-20180207/runtime/platform/darwin.c Examining data/mlton-20180207/runtime/platform/x86.h Examining data/mlton-20180207/runtime/platform/windows.c Examining data/mlton-20180207/runtime/platform/amd64.h Examining data/mlton-20180207/runtime/platform/freebsd.h Examining data/mlton-20180207/runtime/platform/mips64.h Examining data/mlton-20180207/runtime/platform/linux.c Examining data/mlton-20180207/runtime/platform/riscv64.h Examining data/mlton-20180207/runtime/util/safe.h Examining data/mlton-20180207/runtime/util/die.h Examining data/mlton-20180207/runtime/util/to-string.h Examining data/mlton-20180207/runtime/util/pointer.h Examining data/mlton-20180207/runtime/util/read_write.h Examining data/mlton-20180207/runtime/util/die.c Examining data/mlton-20180207/runtime/util/align.h Examining data/mlton-20180207/runtime/util/endian.h Examining data/mlton-20180207/runtime/util/to-string.c Examining data/mlton-20180207/runtime/platform.h Examining data/mlton-20180207/runtime/basis/coerce.h Examining data/mlton-20180207/runtime/basis/cpointer.c Examining data/mlton-20180207/runtime/basis/MLton/Syslog/Syslog.c Examining data/mlton-20180207/runtime/basis/MLton/Syslog/Syslog-consts.c Examining data/mlton-20180207/runtime/basis/MLton/Process/spawnp.c Examining data/mlton-20180207/runtime/basis/MLton/Process/spawne.c Examining data/mlton-20180207/runtime/basis/MLton/Rlimit/rlimit-consts.c Examining data/mlton-20180207/runtime/basis/MLton/Rlimit/rlimit.c Examining data/mlton-20180207/runtime/basis/MLton/Rusage/rusage.c Examining data/mlton-20180207/runtime/basis/MLton/bug.c Examining data/mlton-20180207/runtime/basis/MLton/Itimer/itimer-consts.c Examining data/mlton-20180207/runtime/basis/MLton/Itimer/set.c Examining data/mlton-20180207/runtime/basis/coerce.c Examining data/mlton-20180207/runtime/basis/Real/gdtoa.c Examining data/mlton-20180207/runtime/basis/Real/strtor.c Examining data/mlton-20180207/runtime/basis/Real/Math.c Examining data/mlton-20180207/runtime/basis/Real/Real.c Examining data/mlton-20180207/runtime/basis/Real/Real-consts.c Examining data/mlton-20180207/runtime/basis/Real/Real-ops.h Examining data/mlton-20180207/runtime/basis/Real/Math-fns.h Examining data/mlton-20180207/runtime/basis/Real/IEEEReal.c Examining data/mlton-20180207/runtime/basis/Real/IEEEReal-consts.c Examining data/mlton-20180207/runtime/basis/Word/Word-check.h Examining data/mlton-20180207/runtime/basis/Word/Word.c Examining data/mlton-20180207/runtime/basis/Word/Word-ops.h Examining data/mlton-20180207/runtime/basis/Word/Word-consts.h Examining data/mlton-20180207/runtime/basis/System/Date.c Examining data/mlton-20180207/runtime/basis/System/OS/IO/poll-consts.c Examining data/mlton-20180207/runtime/basis/System/OS/IO/poll.c Examining data/mlton-20180207/runtime/basis/System/Time.c Examining data/mlton-20180207/runtime/basis/System/CommandLine.c Examining data/mlton-20180207/runtime/basis/cpointer.h Examining data/mlton-20180207/runtime/basis/IntInf/int-inf.c Examining data/mlton-20180207/runtime/basis/Net/NetHostDB.c Examining data/mlton-20180207/runtime/basis/Net/NetHostDB-consts.c Examining data/mlton-20180207/runtime/basis/Net/Net.c Examining data/mlton-20180207/runtime/basis/Net/NetProtDB.c Examining data/mlton-20180207/runtime/basis/Net/NetServDB.c Examining data/mlton-20180207/runtime/basis/Net/Socket/select.c Examining data/mlton-20180207/runtime/basis/Net/Socket/INetSock.c Examining data/mlton-20180207/runtime/basis/Net/Socket/GenericSock.c Examining data/mlton-20180207/runtime/basis/Net/Socket/INetSock-consts.c Examining data/mlton-20180207/runtime/basis/Net/Socket/UnixSock.c Examining data/mlton-20180207/runtime/basis/Net/Socket/Socket-consts.c Examining data/mlton-20180207/runtime/basis/Net/Socket/Socket.c Examining data/mlton-20180207/runtime/basis/Posix/Signal-consts.c Examining data/mlton-20180207/runtime/basis/Posix/TTY-consts.c Examining data/mlton-20180207/runtime/basis/Posix/IO/dup2.c Examining data/mlton-20180207/runtime/basis/Posix/IO/fcntl-consts.c Examining data/mlton-20180207/runtime/basis/Posix/IO/dup.c Examining data/mlton-20180207/runtime/basis/Posix/IO/write.c Examining data/mlton-20180207/runtime/basis/Posix/IO/FLock-consts.c Examining data/mlton-20180207/runtime/basis/Posix/IO/fsync.c Examining data/mlton-20180207/runtime/basis/Posix/IO/fcntl3.c Examining data/mlton-20180207/runtime/basis/Posix/IO/FLock.c Examining data/mlton-20180207/runtime/basis/Posix/IO/close.c Examining data/mlton-20180207/runtime/basis/Posix/IO/fcntl2.c Examining data/mlton-20180207/runtime/basis/Posix/IO/lseek-consts.c Examining data/mlton-20180207/runtime/basis/Posix/IO/read.c Examining data/mlton-20180207/runtime/basis/Posix/IO/lseek.c Examining data/mlton-20180207/runtime/basis/Posix/IO/pipe.c Examining data/mlton-20180207/runtime/basis/Posix/SysDB/Group.c Examining data/mlton-20180207/runtime/basis/Posix/SysDB/Passwd.c Examining data/mlton-20180207/runtime/basis/Posix/Error-consts.c Examining data/mlton-20180207/runtime/basis/Posix/Process/ifExited.c Examining data/mlton-20180207/runtime/basis/Posix/Process/termSig.c Examining data/mlton-20180207/runtime/basis/Posix/Process/ifStopped.c Examining data/mlton-20180207/runtime/basis/Posix/Process/exece.c Examining data/mlton-20180207/runtime/basis/Posix/Process/alarm.c Examining data/mlton-20180207/runtime/basis/Posix/Process/fork.c Examining data/mlton-20180207/runtime/basis/Posix/Process/ifSignaled.c Examining data/mlton-20180207/runtime/basis/Posix/Process/sleep.c Examining data/mlton-20180207/runtime/basis/Posix/Process/exit.c Examining data/mlton-20180207/runtime/basis/Posix/Process/stopSig.c Examining data/mlton-20180207/runtime/basis/Posix/Process/kill.c Examining data/mlton-20180207/runtime/basis/Posix/Process/execp.c Examining data/mlton-20180207/runtime/basis/Posix/Process/system.c Examining data/mlton-20180207/runtime/basis/Posix/Process/pause.c Examining data/mlton-20180207/runtime/basis/Posix/Process/exitStatus.c Examining data/mlton-20180207/runtime/basis/Posix/Process/waitpid.c Examining data/mlton-20180207/runtime/basis/Posix/Process/nanosleep.c Examining data/mlton-20180207/runtime/basis/Posix/Process/waitpid-consts.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/readlink.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/FileSys-consts.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/open2.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/fpathconf.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/fchdir.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/ST.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/mkdir.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/chown.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/fchown.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/rmdir.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/pathconf.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/getcwd.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/Stat.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/truncate.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/chdir.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/umask.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/Utimbuf.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/Dirstream.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/access.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/symlink.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/link.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/chmod.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/ftruncate.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/unlink.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/fchmod.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/open3.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/mkfifo.c Examining data/mlton-20180207/runtime/basis/Posix/FileSys/rename.c Examining data/mlton-20180207/runtime/basis/Posix/Error.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/ProcEnv.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/getenv.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/isatty.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/Times.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/sysconf-consts.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/getgroups.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/sysconf.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/environ.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/setenv.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/getlogin.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/ttyname.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/Uname.c Examining data/mlton-20180207/runtime/basis/Posix/ProcEnv/setgroups.c Examining data/mlton-20180207/runtime/basis/Posix/TTY.c Examining data/mlton-20180207/runtime/basis/Posix/Signal.c Examining data/mlton-20180207/runtime/basis/Stdio.c Examining data/mlton-20180207/runtime/gc.c Examining data/mlton-20180207/runtime/gc.h Examining data/mlton-20180207/runtime/export.h Examining data/mlton-20180207/runtime/platform.c Examining data/mlton-20180207/runtime/basis-ffi.h Examining data/mlton-20180207/runtime/gc/signals.c Examining data/mlton-20180207/runtime/gc/size.h Examining data/mlton-20180207/runtime/gc/object-size.c Examining data/mlton-20180207/runtime/gc/garbage-collection.c Examining data/mlton-20180207/runtime/gc/pack.c Examining data/mlton-20180207/runtime/gc/controls.c Examining data/mlton-20180207/runtime/gc/objptr.c Examining data/mlton-20180207/runtime/gc/weak.c Examining data/mlton-20180207/runtime/gc/enter_leave.c Examining data/mlton-20180207/runtime/gc/profiling.c Examining data/mlton-20180207/runtime/gc/read_write.c Examining data/mlton-20180207/runtime/gc/init-world.c Examining data/mlton-20180207/runtime/gc/call-stack.h Examining data/mlton-20180207/runtime/gc/world.h Examining data/mlton-20180207/runtime/gc/object-size.h Examining data/mlton-20180207/runtime/gc/hash-cons.c Examining data/mlton-20180207/runtime/gc/handler.c Examining data/mlton-20180207/runtime/gc/statistics.h Examining data/mlton-20180207/runtime/gc/virtual-memory.c Examining data/mlton-20180207/runtime/gc/profiling.h Examining data/mlton-20180207/runtime/gc/copy-thread.h Examining data/mlton-20180207/runtime/gc/translate.h Examining data/mlton-20180207/runtime/gc/done.h Examining data/mlton-20180207/runtime/gc/sources.c Examining data/mlton-20180207/runtime/gc/init.h Examining data/mlton-20180207/runtime/gc/invariant.h Examining data/mlton-20180207/runtime/gc/translate.c Examining data/mlton-20180207/runtime/gc/new-object.h Examining data/mlton-20180207/runtime/gc/pointer.h Examining data/mlton-20180207/runtime/gc/forward.h Examining data/mlton-20180207/runtime/gc/array.h Examining data/mlton-20180207/runtime/gc/atomic.c Examining data/mlton-20180207/runtime/gc/cheney-copy.c Examining data/mlton-20180207/runtime/gc/weak.h Examining data/mlton-20180207/runtime/gc/invariant.c Examining data/mlton-20180207/runtime/gc/frame.c Examining data/mlton-20180207/runtime/gc/thread.h Examining data/mlton-20180207/runtime/gc/statistics.c Examining data/mlton-20180207/runtime/gc/heap_predicates.c Examining data/mlton-20180207/runtime/gc/foreach.c Examining data/mlton-20180207/runtime/gc/int-inf.h Examining data/mlton-20180207/runtime/gc/new-object.c Examining data/mlton-20180207/runtime/gc/array-allocate.h Examining data/mlton-20180207/runtime/gc/rusage.h Examining data/mlton-20180207/runtime/gc/size.c Examining data/mlton-20180207/runtime/gc/pack.h Examining data/mlton-20180207/runtime/gc/mark-compact.c Examining data/mlton-20180207/runtime/gc/string.c Examining data/mlton-20180207/runtime/gc/object.h Examining data/mlton-20180207/runtime/gc/model.c Examining data/mlton-20180207/runtime/gc/done.c Examining data/mlton-20180207/runtime/gc/init.c Examining data/mlton-20180207/runtime/gc/mark-compact.h Examining data/mlton-20180207/runtime/gc/debug.h Examining data/mlton-20180207/runtime/gc/major.h Examining data/mlton-20180207/runtime/gc/hash-cons.h Examining data/mlton-20180207/runtime/gc/gc_state.c Examining data/mlton-20180207/runtime/gc/string.h Examining data/mlton-20180207/runtime/gc/forward.c Examining data/mlton-20180207/runtime/gc/handler.h Examining data/mlton-20180207/runtime/gc/cheney-copy.h Examining data/mlton-20180207/runtime/gc/switch-thread.h Examining data/mlton-20180207/runtime/gc/array.c Examining data/mlton-20180207/runtime/gc/dfs-mark.h Examining data/mlton-20180207/runtime/gc/pointer.c Examining data/mlton-20180207/runtime/gc/share.h Examining data/mlton-20180207/runtime/gc/object.c Examining data/mlton-20180207/runtime/gc/call-stack.c Examining data/mlton-20180207/runtime/gc/current.c Examining data/mlton-20180207/runtime/gc/sources.h Examining data/mlton-20180207/runtime/gc/dfs-mark.c Examining data/mlton-20180207/runtime/gc/stack.c Examining data/mlton-20180207/runtime/gc/model.h Examining data/mlton-20180207/runtime/gc/enter_leave.h Examining data/mlton-20180207/runtime/gc/share.c Examining data/mlton-20180207/runtime/gc/switch-thread.c Examining data/mlton-20180207/runtime/gc/signals.h Examining data/mlton-20180207/runtime/gc/init-world.h Examining data/mlton-20180207/runtime/gc/objptr.h Examining data/mlton-20180207/runtime/gc/foreach.h Examining data/mlton-20180207/runtime/gc/garbage-collection.h Examining data/mlton-20180207/runtime/gc/controls.h Examining data/mlton-20180207/runtime/gc/align.h Examining data/mlton-20180207/runtime/gc/frame.h Examining data/mlton-20180207/runtime/gc/generational.c Examining data/mlton-20180207/runtime/gc/atomic.h Examining data/mlton-20180207/runtime/gc/align.c Examining data/mlton-20180207/runtime/gc/thread.c Examining data/mlton-20180207/runtime/gc/rusage.c Examining data/mlton-20180207/runtime/gc/generational.h Examining data/mlton-20180207/runtime/gc/copy-thread.c Examining data/mlton-20180207/runtime/gc/int-inf.c Examining data/mlton-20180207/runtime/gc/gc_state.h Examining data/mlton-20180207/runtime/gc/heap.c Examining data/mlton-20180207/runtime/gc/array-allocate.c Examining data/mlton-20180207/runtime/gc/heap.h Examining data/mlton-20180207/runtime/gc/stack.h Examining data/mlton-20180207/runtime/gc/current.h Examining data/mlton-20180207/runtime/gc/sysvals.h Examining data/mlton-20180207/runtime/gc/world.c Examining data/mlton-20180207/runtime/gen/gen-sizes.c Examining data/mlton-20180207/runtime/gen/basis-ffi.h Examining data/mlton-20180207/runtime/gen/gen-types.c Examining data/mlton-20180207/runtime/util.c Examining data/mlton-20180207/runtime/cenv.h FINAL RESULTS: data/mlton-20180207/runtime/basis/Posix/FileSys/chmod.c:4:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. return chmod ((const char *) p, m); data/mlton-20180207/runtime/basis/Posix/FileSys/chown.c:4:10: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. return chown ((const char *) p, u, g); data/mlton-20180207/runtime/basis/Posix/FileSys/readlink.c:4:10: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. return readlink ((const char*)p, (char*)b, n); data/mlton-20180207/runtime/platform/mingw.c:509:5: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. int chown (__attribute__ ((unused)) const char *path, data/mlton-20180207/runtime/platform/mingw.c:552:5: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. int readlink (__attribute__ ((unused)) const char *path, data/mlton-20180207/runtime/platform/mingw.h:643:8: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. #undef chown data/mlton-20180207/runtime/platform/mingw.h:652:8: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. #undef readlink data/mlton-20180207/runtime/platform/mingw.h:656:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. #define chown MLton_chown data/mlton-20180207/runtime/platform/mingw.h:665:9: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. #define readlink MLton_readlink data/mlton-20180207/runtime/platform/mingw.h:670:31: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. #define mkdir(f, m) mkdir(f); chmod(f, m) data/mlton-20180207/runtime/basis/Posix/FileSys/access.c:4: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 ((const char *) f, i); data/mlton-20180207/runtime/basis/Posix/ProcEnv/getlogin.c:4:15: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. char *res = getlogin (); data/mlton-20180207/runtime/basis/Posix/Process/system.c:4:10: [4] (shell) system: 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. return system ((const char*) cmd); data/mlton-20180207/runtime/gc/call-stack.c:43:5: [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. fprintf (stderr, FMTPTR" = GC_frameIndexSourceSeq ("FMTFI")\n", data/mlton-20180207/runtime/gc/copy-thread.c:24:5: [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. fprintf (stderr, FMTPTR" = copyThread ("FMTPTR")\n", data/mlton-20180207/runtime/gc/copy-thread.c:52:5: [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. fprintf (stderr, FMTPTR" = GC_copyCurrentThread\n", (uintptr_t)toThread); data/mlton-20180207/runtime/gc/copy-thread.c:73:5: [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. fprintf (stderr, FMTPTR" = GC_copyThread ("FMTPTR")\n", data/mlton-20180207/runtime/gc/frame.c:14:5: [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. fprintf (stderr, FMTFI" = getFrameIndexFromReturnAddress ("FMTRA")\n", data/mlton-20180207/runtime/gc/hash-cons.c:88:5: [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. fprintf (stderr, FMTPTR" = allocHashTable ()\n", (uintptr_t)t); data/mlton-20180207/runtime/gc/hash-cons.c:277:5: [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. fprintf (stderr, FMTPTR" = hashConsPointer ("FMTPTR")\n", data/mlton-20180207/runtime/gc/new-object.c:43:5: [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. fprintf (stderr, FMTPTR " = newObject ("FMTHDR", %"PRIuMAX", %s)\n", data/mlton-20180207/runtime/gc/new-object.c:65:5: [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. fprintf (stderr, FMTPTR " = newStack (%"PRIuMAX")\n", data/mlton-20180207/runtime/gc/new-object.c:87:5: [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. fprintf (stderr, FMTPTR" = newThreadOfSize (%"PRIuMAX")\n", data/mlton-20180207/runtime/gc/object.c:111:5: [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. fprintf (stderr, FMTPTR" = advanceToObjectData ("FMTPTR")\n", data/mlton-20180207/runtime/gc/profiling.c:221:5: [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. fprintf (stderr, FMTPTR" = profileMalloc ()\n", (uintptr_t)p); data/mlton-20180207/runtime/gc/sources.c:76:7: [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. fprintf (stderr, FMTPTR" "FMTSSI"\n", data/mlton-20180207/runtime/gc/weak.c:52:5: [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. fprintf (stderr, FMTPTR" = GC_weakGet ("FMTPTR")\n", data/mlton-20180207/runtime/gc/weak.c:67:5: [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. fprintf (stderr, FMTPTR" = GC_weakNew ("FMTHDR", "FMTPTR")\n", data/mlton-20180207/runtime/platform.h:55:16: [4] (shell) execvp: 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. #define EXECVP execvp data/mlton-20180207/runtime/platform/darwin.c:16:15: [4] (shell) system: 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. (void)system (buffer); data/mlton-20180207/runtime/platform/displayMem.proc.c:6:15: [4] (shell) system: 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. res = system (buffer); data/mlton-20180207/runtime/platform/freebsd.c:13:15: [4] (shell) system: 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. (void)system (buffer); data/mlton-20180207/runtime/platform/linux.h:93: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(x, buf); data/mlton-20180207/runtime/platform/mingw.c:656:7: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. char *getlogin (void) { data/mlton-20180207/runtime/platform/mingw.c:762:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf->machine, platform, level); data/mlton-20180207/runtime/platform/mingw.c:846:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf->sysname, "%s_%s-%d.%d", mingw_name, data/mlton-20180207/runtime/platform/mingw.c:1379: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). strcpy(buffer, MLton_strerrorExtension(code)); data/mlton-20180207/runtime/platform/mingw.c:1428:6: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. void syslog(int priority, __attribute__ ((unused)) const char* fmt, const char* msg) { data/mlton-20180207/runtime/platform/mingw.h:776:8: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. #undef getlogin data/mlton-20180207/runtime/platform/mingw.h:797:9: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. #define getlogin MLton_getlogin data/mlton-20180207/runtime/platform/mingw.h:825:29: [4] (shell) execvp: 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. #define EXECVP(file, args) execvp (file, (const char* const*) args) data/mlton-20180207/runtime/platform/mingw.h:1722:8: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #undef syslog data/mlton-20180207/runtime/platform/mingw.h:1726:9: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #define syslog MLton_syslog data/mlton-20180207/runtime/platform/solaris.c:50:9: [4] (shell) system: 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. system (buffer); data/mlton-20180207/runtime/platform/windows.c:137:17: [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. fprintf(stderr, FMTPTR " %10"PRIuMAX" %s %s\n", data/mlton-20180207/runtime/util/die.c:15:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/mlton-20180207/runtime/util/die.c:26:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/mlton-20180207/runtime/util/die.h:11:49: [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. __attribute__ ((format(printf, 1, 2))) data/mlton-20180207/runtime/util/die.h:15:50: [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. __attribute__ ((format(printf, 1, 2))) data/mlton-20180207/runtime/util/read_write.h:58:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buf, BUF_SIZE, "%"PRIu32, u); data/mlton-20180207/runtime/util/read_write.h:65:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buf, BUF_SIZE, "%"PRIuMAX, u); data/mlton-20180207/runtime/util/read_write.h:72:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buf, BUF_SIZE, "0x%08"PRIx32, u); data/mlton-20180207/runtime/util/read_write.h:79:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buf, BUF_SIZE, "0x%0*"PRIxMAX, (int)(2 * sizeof(uintmax_t)), u); data/mlton-20180207/runtime/util/to-string.c:31:7: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. l = snprintf(tmp, BUF_SIZE, "%"PRIdMAX, n); data/mlton-20180207/runtime/util/to-string.c:75:7: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. l = snprintf(tmp, BUF_SIZE, "%"PRIuMAX, n); data/mlton-20180207/runtime/basis/Posix/ProcEnv/getenv.c:4:15: [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 *res = getenv((const char*)s); data/mlton-20180207/runtime/platform/diskBack.unix.c:10:12: [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. tmpDir = getenv ("TMP"); data/mlton-20180207/runtime/platform/diskBack.unix.c:12:14: [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. tmpDir = getenv ("TMPDIR"); data/mlton-20180207/runtime/platform/mingw.c:61:18: [3] (tmpfile) GetTempFileName: Temporary file race condition in certain cases (e.g., if run as SYSTEM in many versions of Windows) (CWE-377). if (0 == GetTempFileName (file_path, templ, 0, file_name)) data/mlton-20180207/runtime/platform/mingw.c:684:31: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (not overwrite and getenv (name)) { data/mlton-20180207/runtime/platform/setenv.putenv.c:8:27: [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 (!overwrite && getenv (name)) data/mlton-20180207/runtime/platform/windows.c:18:13: [3] (tmpfile) GetTempFileName: Temporary file race condition in certain cases (e.g., if run as SYSTEM in many versions of Windows) (CWE-377). uRetVal = GetTempFileName(lpPathBuffer, TEXT("MLtonTempFile"), 0, szTempName); data/mlton-20180207/include/c-chunk.h:214:29: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. MLTON_CODEGEN_MEMCPY(void * memcpy(void *, const void*, size_t);) data/mlton-20180207/runtime/basis/Posix/FileSys/open2.c:4: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). return open ((const char*)p, i); data/mlton-20180207/runtime/basis/Posix/FileSys/open3.c:4: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). return open ((const char*)p, i, (mode_t)m); data/mlton-20180207/runtime/basis/Real/Real-ops.h:30:5: [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(&r, rp, sizeof(Real##size##_t)); \ data/mlton-20180207/runtime/basis/Real/Real-ops.h:35:5: [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(rp, &r, sizeof(Real##size##_t)); \ data/mlton-20180207/runtime/basis/Real/Real-ops.h:40:5: [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(dst, src, sizeof(Real##size##_t)); \ data/mlton-20180207/runtime/basis/Real/gdtoa.c:12: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(L, &f, sizeof(Real32_t)); data/mlton-20180207/runtime/basis/Real/gdtoa.c:40: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(L, &d, sizeof(Real64_t)); data/mlton-20180207/runtime/basis/Word/Word-ops.h:50:5: [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(&w, wp, sizeof(Word##size##_t)); \ data/mlton-20180207/runtime/basis/Word/Word-ops.h:55:5: [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(wp, &w, sizeof(Word##size##_t)); \ data/mlton-20180207/runtime/basis/Word/Word-ops.h:60:5: [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(dst, src, sizeof(Word##size##_t)); \ data/mlton-20180207/runtime/basis/coerce.h:42:5: [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(&y, &x, sizeof(t)); \ data/mlton-20180207/runtime/gc/init-world.c:74:5: [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 (frontier, inits[i].words, dataBytes); data/mlton-20180207/runtime/gc/init.c:124:37: [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). s->controls.summaryFile = fopen(argv[i++], "w"); data/mlton-20180207/runtime/gc/string.h:16: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 chars[1]; data/mlton-20180207/runtime/gc/virtual-memory.c:28: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 (dst, src, size); data/mlton-20180207/runtime/gc/world.c:55:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[128]; data/mlton-20180207/runtime/gc/world.c:93:7: [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 ((const char*)fileName, "wb"); data/mlton-20180207/runtime/platform/aix.c:103: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. char fname[128]; data/mlton-20180207/runtime/platform/aix.c:112:14: [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). fd = open (fname, O_RDONLY); data/mlton-20180207/runtime/platform/cygwin.c:114:16: [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 res[MAX_PATH]; data/mlton-20180207/runtime/platform/darwin.c:13:16: [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 buffer[256]; data/mlton-20180207/runtime/platform/displayMem.proc.c:2:16: [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 buffer[256]; data/mlton-20180207/runtime/platform/freebsd.c:10:16: [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 buffer[256]; data/mlton-20180207/runtime/platform/hpux.c:53:16: [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 fname[256]; data/mlton-20180207/runtime/platform/hpux.c:57:17: [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 (fname, "unknown"); data/mlton-20180207/runtime/platform/mingw.c:52:5: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int mkstemp (char *template) { data/mlton-20180207/runtime/platform/mingw.c:53: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. char file_path[255]; data/mlton-20180207/runtime/platform/mingw.c:54: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. char file_name[255]; data/mlton-20180207/runtime/platform/mingw.c:55: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. char templ[4]; data/mlton-20180207/runtime/platform/mingw.c:495: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. char fname[MAX_PATH + 1]; data/mlton-20180207/runtime/platform/mingw.c:502: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. char fname[MAX_PATH + 1]; data/mlton-20180207/runtime/platform/mingw.c:567: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 ((fd = open(path, O_RDWR)) == -1) data/mlton-20180207/runtime/platform/mingw.c:855:17: [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 (buf->nodename, "unknown"); data/mlton-20180207/runtime/platform/mingw.c:858:9: [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 (buf->release, "%d", __MINGW64_VERSION_MINOR); data/mlton-20180207/runtime/platform/mingw.c:859:9: [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 (buf->version, "%d", __MINGW64_VERSION_MAJOR); data/mlton-20180207/runtime/platform/mingw.c:861:9: [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 (buf->release, "%d", __MINGW32_MINOR_VERSION); data/mlton-20180207/runtime/platform/mingw.c:862:9: [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 (buf->version, "%d", __MINGW32_MAJOR_VERSION); data/mlton-20180207/runtime/platform/mingw.c:1373:16: [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 buffer[80]; data/mlton-20180207/runtime/platform/mingw.h:78:8: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). #undef mkstemp data/mlton-20180207/runtime/platform/mingw.h:81:9: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). #define mkstemp MLton_mkstemp data/mlton-20180207/runtime/platform/mingw.h:742: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. char machine[20]; data/mlton-20180207/runtime/platform/mingw.h:743: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. char nodename[256]; data/mlton-20180207/runtime/platform/mingw.h:744: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. char release[20]; data/mlton-20180207/runtime/platform/mingw.h:745: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. char sysname[30]; data/mlton-20180207/runtime/platform/mingw.h:746: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. char version[20]; data/mlton-20180207/runtime/platform/mingw.h:1570: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. char sun_path[UNIX_PATH_MAX]; data/mlton-20180207/runtime/platform/mremap.c:101: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(alloc, base, oldLength); data/mlton-20180207/runtime/platform/solaris.c:48:16: [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 buffer[256]; data/mlton-20180207/runtime/platform/solaris.c:71:22: [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). fd = open ("/dev/zero", O_RDONLY); data/mlton-20180207/runtime/platform/windows.c:11:3: [2] (buffer) TCHAR: 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. TCHAR szTempName[BUFSIZE]; data/mlton-20180207/runtime/platform/windows.c:12:3: [2] (buffer) TCHAR: 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. TCHAR lpPathBuffer[BUFSIZE]; data/mlton-20180207/runtime/util/endian.h:14: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(&y, &x, sizeof(uint8_t)); data/mlton-20180207/runtime/util/read_write.h:56: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. static char buf[BUF_SIZE]; data/mlton-20180207/runtime/util/read_write.h:63: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. static char buf[BUF_SIZE]; data/mlton-20180207/runtime/util/read_write.h:70: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. static char buf[BUF_SIZE]; data/mlton-20180207/runtime/util/read_write.h:77: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. static char buf[BUF_SIZE]; data/mlton-20180207/runtime/util/safe.h:40: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). res = fopen (fileName, mode); data/mlton-20180207/runtime/util/safe.h:91:8: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp (template); data/mlton-20180207/runtime/util/to-string.c:17: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. static char buf1[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:18: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. static char buf2[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:19: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. static char buf3[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:20: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. static char buf4[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:21: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. static char buf5[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:25:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:61: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. static char buf1[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:62: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. static char buf2[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:63: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. static char buf3[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:64: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. static char buf4[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:65: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. static char buf5[BUF_SIZE]; data/mlton-20180207/runtime/util/to-string.c:69:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[BUF_SIZE]; data/mlton-20180207/runtime/basis/Posix/FileSys/umask.c:4:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). return umask (m); data/mlton-20180207/runtime/basis/Posix/IO/read.c:6:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read (fd, (void *) ((char *) b + i), s); data/mlton-20180207/runtime/basis/Real/Real-ops.h:49:15: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. compare(size, equal, ==) \ data/mlton-20180207/runtime/basis/Word/Word-ops.h:67:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. compare (size, equal, ==) \ data/mlton-20180207/runtime/gc/done.c:15: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). len = strlen (s); data/mlton-20180207/runtime/gc/int-inf.c:312: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). size = strlen(str); data/mlton-20180207/runtime/gc/world.c:66: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). len = strlen(buf) + 1; /* +1 to get the '\000' */ data/mlton-20180207/runtime/gen/gen-types.c:180:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). for (size_t i = 0; i < strlen(btLower); i++) \ data/mlton-20180207/runtime/gen/gen-types.c:183:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). for (size_t i = 0; i < strlen(btUpper); i++) \ data/mlton-20180207/runtime/gen/gen-types.c:239:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). for (size_t i = 0; i < strlen(btLower); i++) \ data/mlton-20180207/runtime/gen/gen-types.c:242:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). for (size_t i = 0; i < strlen(btUpper); i++) \ data/mlton-20180207/runtime/platform/aix.c:123:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read (fd, buf, BUFLEN); data/mlton-20180207/runtime/platform/aix.c:128:22: [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). m += strlen (m) + 1; data/mlton-20180207/runtime/platform/diskBack.unix.c:16: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). tmpDirLen = strlen(tmpDir); data/mlton-20180207/runtime/platform/diskBack.unix.c:17:12: [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). tagLen = strlen(tag); data/mlton-20180207/runtime/platform/diskBack.unix.c:19:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (template, tmpDir, tmpDirLen + 1); data/mlton-20180207/runtime/platform/diskBack.unix.c:20:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (template + tmpDirLen, tag, tagLen + 1); data/mlton-20180207/runtime/platform/diskBack.unix.c:21:7: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). m = umask(077); data/mlton-20180207/runtime/platform/diskBack.unix.c:24:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(m); data/mlton-20180207/runtime/platform/mingw.c:59:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (templ, template, sizeof (templ) - 1); data/mlton-20180207/runtime/platform/setenv.putenv.c:11: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). len = strlen (name) + strlen (value) + 2 /* = and \000 */; data/mlton-20180207/runtime/platform/setenv.putenv.c:11:31: [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 (name) + strlen (value) + 2 /* = and \000 */; data/mlton-20180207/runtime/util/read_write.h:51:22: [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). fwrite_safe (s, 1, strlen(s), f); ANALYSIS SUMMARY: Hits = 156 Lines analyzed = 24159 in approximately 0.84 seconds (28635 lines/second) Physical Source Lines of Code (SLOC) = 18581 Hits@level = [0] 343 [1] 23 [2] 71 [3] 7 [4] 45 [5] 10 Hits@level+ = [0+] 499 [1+] 156 [2+] 133 [3+] 62 [4+] 55 [5+] 10 Hits/KSLOC@level+ = [0+] 26.8554 [1+] 8.39567 [2+] 7.15785 [3+] 3.33674 [4+] 2.96001 [5+] 0.538184 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.