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/osmose-emulator-1.6/src/AnsiColorTerminal.h
Examining data/osmose-emulator-1.6/src/BasicTypes.h
Examining data/osmose-emulator-1.6/src/Bits.h
Examining data/osmose-emulator-1.6/src/DebugEventListener.h
Examining data/osmose-emulator-1.6/src/DebugEventThrower.cpp
Examining data/osmose-emulator-1.6/src/DebugEventThrower.h
Examining data/osmose-emulator-1.6/src/Definitions.h
Examining data/osmose-emulator-1.6/src/EmulationThread.cpp
Examining data/osmose-emulator-1.6/src/EmulationThread.h
Examining data/osmose-emulator-1.6/src/FIFOSoundBuffer.cpp
Examining data/osmose-emulator-1.6/src/FIFOSoundBuffer.h
Examining data/osmose-emulator-1.6/src/IOMapper.cpp
Examining data/osmose-emulator-1.6/src/IOMapper.h
Examining data/osmose-emulator-1.6/src/IOMapper_GG.cpp
Examining data/osmose-emulator-1.6/src/IOMapper_GG.h
Examining data/osmose-emulator-1.6/src/Joystick.cpp
Examining data/osmose-emulator-1.6/src/Joystick.h
Examining data/osmose-emulator-1.6/src/KeyMapper.cpp
Examining data/osmose-emulator-1.6/src/KeyMapper.h
Examining data/osmose-emulator-1.6/src/MemoryMapper.cpp
Examining data/osmose-emulator-1.6/src/MemoryMapper.h
Examining data/osmose-emulator-1.6/src/Opc_cbxx.cpp
Examining data/osmose-emulator-1.6/src/Opc_dd.cpp
Examining data/osmose-emulator-1.6/src/Opc_ddcb.cpp
Examining data/osmose-emulator-1.6/src/Opc_ed.cpp
Examining data/osmose-emulator-1.6/src/Opc_fd.cpp
Examining data/osmose-emulator-1.6/src/Opc_fdcb.cpp
Examining data/osmose-emulator-1.6/src/Opc_std.cpp
Examining data/osmose-emulator-1.6/src/Options.cpp
Examining data/osmose-emulator-1.6/src/Options.h
Examining data/osmose-emulator-1.6/src/OsmoseConfigurationFile.cpp
Examining data/osmose-emulator-1.6/src/OsmoseConfigurationFile.h
Examining data/osmose-emulator-1.6/src/OsmoseCore.cpp
Examining data/osmose-emulator-1.6/src/OsmoseCore.h
Examining data/osmose-emulator-1.6/src/OsmoseEmulationThread.cpp
Examining data/osmose-emulator-1.6/src/OsmoseEmulationThread.h
Examining data/osmose-emulator-1.6/src/OsmoseGUI.cpp
Examining data/osmose-emulator-1.6/src/OsmoseGUI.h
Examining data/osmose-emulator-1.6/src/Pthreadcpp.cpp
Examining data/osmose-emulator-1.6/src/Pthreadcpp.h
Examining data/osmose-emulator-1.6/src/QGLImage.cpp
Examining data/osmose-emulator-1.6/src/QGLImage.h
Examining data/osmose-emulator-1.6/src/QLogWindow.cpp
Examining data/osmose-emulator-1.6/src/QLogWindow.h
Examining data/osmose-emulator-1.6/src/QOsmoseConfiguration.cpp
Examining data/osmose-emulator-1.6/src/QOsmoseConfiguration.h
Examining data/osmose-emulator-1.6/src/RomSpecificOption.cpp
Examining data/osmose-emulator-1.6/src/RomSpecificOption.h
Examining data/osmose-emulator-1.6/src/SN76489.cpp
Examining data/osmose-emulator-1.6/src/SN76489.h
Examining data/osmose-emulator-1.6/src/SaveState.h
Examining data/osmose-emulator-1.6/src/SmsEnvironment.cpp
Examining data/osmose-emulator-1.6/src/SmsEnvironment.h
Examining data/osmose-emulator-1.6/src/SoundThread.cpp
Examining data/osmose-emulator-1.6/src/SoundThread.h
Examining data/osmose-emulator-1.6/src/TGAWriter.cpp
Examining data/osmose-emulator-1.6/src/TGAWriter.h
Examining data/osmose-emulator-1.6/src/VDP.cpp
Examining data/osmose-emulator-1.6/src/VDP.h
Examining data/osmose-emulator-1.6/src/VDP_GG.cpp
Examining data/osmose-emulator-1.6/src/VDP_GG.h
Examining data/osmose-emulator-1.6/src/Version.h
Examining data/osmose-emulator-1.6/src/WaveWriter.cpp
Examining data/osmose-emulator-1.6/src/WaveWriter.h
Examining data/osmose-emulator-1.6/src/WhiteNoiseEmulationThread.cpp
Examining data/osmose-emulator-1.6/src/WhiteNoiseEmulationThread.h
Examining data/osmose-emulator-1.6/src/Z80.cpp
Examining data/osmose-emulator-1.6/src/Z80.h
Examining data/osmose-emulator-1.6/src/main.cpp

FINAL RESULTS:

data/osmose-emulator-1.6/src/OsmoseConfigurationFile.cpp:46:39:  [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.
	string user_home_directory = string (getenv("HOME"));
data/osmose-emulator-1.6/src/Joystick.cpp:41:20:  [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).
    joystickFD = ::open(dev_name, O_RDONLY | O_NONBLOCK);
data/osmose-emulator-1.6/src/Joystick.cpp:52: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(deviceName, dev_name, MAX_DEVNAME_LEN);
data/osmose-emulator-1.6/src/Joystick.h:78: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 deviceName[MAX_DEVNAME_LEN];
data/osmose-emulator-1.6/src/Joystick.h:79:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char joystickID[MAX_JOYID_LEN];
data/osmose-emulator-1.6/src/MemoryMapper.h:72: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.
    unsigned char paging_regs[4];       // Paging registers.
data/osmose-emulator-1.6/src/MemoryMapper.h:118: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.
        unsigned char   paging_regs[4];     // Paging registers.
data/osmose-emulator-1.6/src/MemoryMapper.h:120: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.
        unsigned char   *write_map[8];	    // 8ko bank ptr for CPU writes.
data/osmose-emulator-1.6/src/MemoryMapper.h:124: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.
        unsigned char   *read_map[8];	    // 8ko bank ptr for CPU reads.
data/osmose-emulator-1.6/src/Options.h:84: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 ini_file[512];         // For name of file containing conf.
data/osmose-emulator-1.6/src/QGLImage.cpp:229: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(scaledTexture, source, sizeLine);
data/osmose-emulator-1.6/src/SoundThread.cpp:38: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(deviceName, devName, DEVICE_NAME_LENGTH);
data/osmose-emulator-1.6/src/SoundThread.h:65: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 deviceName[DEVICE_NAME_LENGTH];
data/osmose-emulator-1.6/src/TGAWriter.h:69: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 cache[INTERNAL_CACHE_SIZE];
data/osmose-emulator-1.6/src/VDP.cpp:30:10:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
unsigned char vcount_ntsc_192[262] =
data/osmose-emulator-1.6/src/VDP.cpp:52:10:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
unsigned char vcount_palsecam_192[313] =
data/osmose-emulator-1.6/src/VDP.cpp:707: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(scr,dst, 1024);
data/osmose-emulator-1.6/src/VDP.cpp:744: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.
    unsigned char  line_spr[8];
data/osmose-emulator-1.6/src/VDP.cpp:745: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.
    unsigned char  start_spr[8];
data/osmose-emulator-1.6/src/VDP.cpp:746: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.
    unsigned char  width_spr[8];
data/osmose-emulator-1.6/src/VDP.h:74: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.
    unsigned char  regs[VDP_REGISTER_NBR];
data/osmose-emulator-1.6/src/VDP.h:109: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.
        unsigned char  tile_mask   [256];              // Pixels above sprites are marked here.
data/osmose-emulator-1.6/src/VDP.h:110: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.
        unsigned char  spr_col     [256];              // Use for sprite collision.
data/osmose-emulator-1.6/src/VDP.h:116: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.
        unsigned char  regs[VDP_REGISTER_NBR];         // VDP Registers.
data/osmose-emulator-1.6/src/VDP.h:139: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.
        unsigned char r_col[4];			   				// Precalc Red possible values.
data/osmose-emulator-1.6/src/VDP.h:140: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.
        unsigned char g_col[4];			   				// Precalc Green possible values.
data/osmose-emulator-1.6/src/VDP.h:141: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.
        unsigned char b_col[4];			   				// Precalc Blue possible values.
data/osmose-emulator-1.6/src/VDP_GG.cpp:263: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(scr+48,dst+48, 640);
data/osmose-emulator-1.6/src/WaveWriter.cpp:70: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).
    waveFile.open(filename, ios::out | ios::binary);
data/osmose-emulator-1.6/src/WaveWriter.h:39:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char           chunkID[4];
data/osmose-emulator-1.6/src/WaveWriter.h:51:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char           chunkID[4];
data/osmose-emulator-1.6/src/FIFOSoundBuffer.cpp:63:22:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
s16 FIFOSoundBuffer::read()
data/osmose-emulator-1.6/src/FIFOSoundBuffer.cpp:88:23:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
void FIFOSoundBuffer::read(s16 *dst, u32 nbr)
data/osmose-emulator-1.6/src/FIFOSoundBuffer.cpp:94:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        dst[i] = read();
data/osmose-emulator-1.6/src/FIFOSoundBuffer.h:46:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        inline s16 read();
data/osmose-emulator-1.6/src/FIFOSoundBuffer.h:49:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        void read(s16 *, u32 nbr);
data/osmose-emulator-1.6/src/Joystick.cpp:57:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
		::strncpy(joystickID, "Unknown", MAX_JOYID_LEN);
data/osmose-emulator-1.6/src/Joystick.cpp:113:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    bytes_read = ::read(joystickFD, jse, sizeof(*jse));
data/osmose-emulator-1.6/src/MemoryMapper.cpp:121:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		file.read((char *)sram,0x8000);
data/osmose-emulator-1.6/src/MemoryMapper.cpp:668:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    file.read((char*)cartridge, rom_size);
data/osmose-emulator-1.6/src/MemoryMapper.cpp:825:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&ram[0], 0x2000);
data/osmose-emulator-1.6/src/MemoryMapper.cpp:829:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&sram[0], 0x8000);
data/osmose-emulator-1.6/src/MemoryMapper.cpp:833:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&mss, sizeof(mss));
data/osmose-emulator-1.6/src/SN76489.cpp:167:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    Fifo_->read(dst, len);
data/osmose-emulator-1.6/src/SN76489.cpp:277:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&s, sizeof(s));
data/osmose-emulator-1.6/src/SoundThread.cpp:151:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	sndFIFO->read(samplebuffer, nframes);
data/osmose-emulator-1.6/src/VDP.cpp:918:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&vss, sizeof(vss));
data/osmose-emulator-1.6/src/VDP.cpp:937:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&VRAM[0], 0x4000);
data/osmose-emulator-1.6/src/VDP.cpp:941:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&CRAM[0], 64);
data/osmose-emulator-1.6/src/Z80.cpp:734:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ifs.read((char *)&css, sizeof(css));

ANALYSIS SUMMARY:

Hits = 50
Lines analyzed = 25511 in approximately 0.53 seconds (48347 lines/second)
Physical Source Lines of Code (SLOC) = 18078
Hits@level = [0]  31 [1]  19 [2]  30 [3]   1 [4]   0 [5]   0
Hits@level+ = [0+]  81 [1+]  50 [2+]  31 [3+]   1 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 4.48058 [1+] 2.76579 [2+] 1.71479 [3+] 0.0553159 [4+]   0 [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.