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/openmsx-debugger-0.1~git20200913/src/VDPRegViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/StackViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/MSXException.h Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/SspiUtils.h Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/SspiUtils.cpp Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/QAbstractSocketStreamWrapper.h Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/QAbstractSocketStreamWrapper.cpp Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/openmsx.h Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/SspiNegotiateClient.h Examining data/openmsx-debugger-0.1~git20200913/src/openmsx/SspiNegotiateClient.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DebugSession.cpp Examining data/openmsx-debugger-0.1~git20200913/src/CommClient.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DasmTables.h Examining data/openmsx-debugger-0.1~git20200913/src/DockableWidgetLayout.h Examining data/openmsx-debugger-0.1~git20200913/src/FlagsViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/VDPStatusRegViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/BitMapViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/VDPStatusRegViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/MainMemoryViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DebugSession.h Examining data/openmsx-debugger-0.1~git20200913/src/DebuggerData.h Examining data/openmsx-debugger-0.1~git20200913/src/CommClient.h Examining data/openmsx-debugger-0.1~git20200913/src/InteractiveButton.cpp Examining data/openmsx-debugger-0.1~git20200913/src/SlotViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/PreferencesDialog.h Examining data/openmsx-debugger-0.1~git20200913/src/BreakpointDialog.h Examining data/openmsx-debugger-0.1~git20200913/src/VDPDataStore.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DockableWidgetArea.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DebuggerForm.h Examining data/openmsx-debugger-0.1~git20200913/src/Settings.cpp Examining data/openmsx-debugger-0.1~git20200913/src/SymbolManager.h Examining data/openmsx-debugger-0.1~git20200913/src/VramBitMappedView.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DasmTables.cpp Examining data/openmsx-debugger-0.1~git20200913/src/StackViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/GotoDialog.cpp Examining data/openmsx-debugger-0.1~git20200913/src/InteractiveButton.h Examining data/openmsx-debugger-0.1~git20200913/src/DisasmViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/Version.cpp Examining data/openmsx-debugger-0.1~git20200913/src/OpenMSXConnection.h Examining data/openmsx-debugger-0.1~git20200913/src/DebuggerData.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DebuggerForm.cpp Examining data/openmsx-debugger-0.1~git20200913/src/Convert.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DockManager.h Examining data/openmsx-debugger-0.1~git20200913/src/DockManager.cpp Examining data/openmsx-debugger-0.1~git20200913/src/BreakpointDialog.cpp Examining data/openmsx-debugger-0.1~git20200913/src/VDPCommandRegViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DisasmViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/VDPCommandRegViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/Settings.h Examining data/openmsx-debugger-0.1~git20200913/src/GotoDialog.h Examining data/openmsx-debugger-0.1~git20200913/src/DockableWidget.h Examining data/openmsx-debugger-0.1~git20200913/src/Dasm.h Examining data/openmsx-debugger-0.1~git20200913/src/MainMemoryViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/CPURegsViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/SymbolTable.h Examining data/openmsx-debugger-0.1~git20200913/src/SymbolManager.cpp Examining data/openmsx-debugger-0.1~git20200913/src/main.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DebuggableViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/PreferencesDialog.cpp Examining data/openmsx-debugger-0.1~git20200913/src/FlagsViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/BitMapViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/DockableWidgetLayout.cpp Examining data/openmsx-debugger-0.1~git20200913/src/Convert.h Examining data/openmsx-debugger-0.1~git20200913/src/OpenMSXConnection.cpp Examining data/openmsx-debugger-0.1~git20200913/src/HexViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/HexViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/CPURegsViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DockableWidget.cpp Examining data/openmsx-debugger-0.1~git20200913/src/InteractiveLabel.cpp Examining data/openmsx-debugger-0.1~git20200913/src/SlotViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/CPURegs.cpp Examining data/openmsx-debugger-0.1~git20200913/src/ConnectDialog.h Examining data/openmsx-debugger-0.1~git20200913/src/VDPRegViewer.cpp Examining data/openmsx-debugger-0.1~git20200913/src/InteractiveLabel.h Examining data/openmsx-debugger-0.1~git20200913/src/VDPDataStore.h Examining data/openmsx-debugger-0.1~git20200913/src/Version.h Examining data/openmsx-debugger-0.1~git20200913/src/ConnectDialog.cpp Examining data/openmsx-debugger-0.1~git20200913/src/SimpleHexRequest.cpp Examining data/openmsx-debugger-0.1~git20200913/src/DebuggableViewer.h Examining data/openmsx-debugger-0.1~git20200913/src/SymbolTable.cpp Examining data/openmsx-debugger-0.1~git20200913/src/Dasm.cpp Examining data/openmsx-debugger-0.1~git20200913/src/SimpleHexRequest.h Examining data/openmsx-debugger-0.1~git20200913/src/DockableWidgetArea.h Examining data/openmsx-debugger-0.1~git20200913/src/CPURegs.h Examining data/openmsx-debugger-0.1~git20200913/src/VramBitMappedView.h FINAL RESULTS: data/openmsx-debugger-0.1~git20200913/src/CPURegsViewer.cpp:130:8: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%04X", regs[id]); data/openmsx-debugger-0.1~git20200913/src/CPURegsViewer.cpp:132:8: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%02X", regs[id]); data/openmsx-debugger-0.1~git20200913/src/CPURegsViewer.cpp:134:8: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%01X", regs[id]); data/openmsx-debugger-0.1~git20200913/src/ConnectDialog.cpp:121:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(addr.sun_path, info.absoluteFilePath().toLatin1().data()); data/openmsx-debugger-0.1~git20200913/src/DisasmViewer.cpp:255:11: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. hexStr.sprintf("%04X", row->addr); data/openmsx-debugger-0.1~git20200913/src/DisasmViewer.cpp:260:12: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. hexStr.sprintf("%02X", displayDisasm ? memory[row->addr + j] : 0); data/openmsx-debugger-0.1~git20200913/src/HexViewer.cpp:305:12: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. hexStr.sprintf("%02X", hexData[address + j]); data/openmsx-debugger-0.1~git20200913/src/HexViewer.cpp:319:16: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. hexStr.sprintf("%2X", editValue); data/openmsx-debugger-0.1~git20200913/src/SlotViewer.cpp:119:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%i", i); data/openmsx-debugger-0.1~git20200913/src/SlotViewer.cpp:123:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("$%04X", i * 0x4000); data/openmsx-debugger-0.1~git20200913/src/SlotViewer.cpp:129:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%i-%i", memLayout->primarySlot[i], data/openmsx-debugger-0.1~git20200913/src/SlotViewer.cpp:156:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%i", memLayout->mapperSegment[i]); data/openmsx-debugger-0.1~git20200913/src/SlotViewer.cpp:159:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("R%i", memLayout->romBlock[2*i]); data/openmsx-debugger-0.1~git20200913/src/SlotViewer.cpp:161:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("R%i/%i", memLayout->romBlock[2*i], memLayout->romBlock[2*i+1]); data/openmsx-debugger-0.1~git20200913/src/StackViewer.cpp:129:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. hexStr.sprintf("%04X", address); data/openmsx-debugger-0.1~git20200913/src/StackViewer.cpp:131:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. hexStr.sprintf("%02X%02X", memory[address + 1], memory[address]); data/openmsx-debugger-0.1~git20200913/src/ConnectDialog.cpp:159: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. QDir dir((getenv("TMPDIR")) ? getenv("TMPDIR") : QDir::tempPath()); data/openmsx-debugger-0.1~git20200913/src/ConnectDialog.cpp:159:32: [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. QDir dir((getenv("TMPDIR")) ? getenv("TMPDIR") : QDir::tempPath()); data/openmsx-debugger-0.1~git20200913/src/openmsx/SspiUtils.cpp:193:5: [3] (misc) AddAccessAllowedAce: This doesn't set the inheritance bits in the access control entry (ACE) header (CWE-732). Make sure that you set inheritance by hand if you wish it to inherit. AddAccessAllowedAce(pacl, ACL_REVISION, ACCESS_ALL, pUserSid) && data/openmsx-debugger-0.1~git20200913/src/BitMapViewer.cpp:6: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 defaultPalette[32] = { data/openmsx-debugger-0.1~git20200913/src/CPURegsViewer.cpp:177: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(®sCopy, ®s, sizeof(regs)); data/openmsx-debugger-0.1~git20200913/src/CPURegsViewer.cpp:322: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 data[26]; data/openmsx-debugger-0.1~git20200913/src/DebugSession.cpp:49: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). void DebugSession::open(const QString& file) data/openmsx-debugger-0.1~git20200913/src/DebugSession.cpp:52: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 (!f.open(QFile::ReadOnly | QFile::Text)) { data/openmsx-debugger-0.1~git20200913/src/DebugSession.cpp:108: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 (!file.open(QFile::WriteOnly | QFile::Text)) { data/openmsx-debugger-0.1~git20200913/src/DebugSession.h:18:7: [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). void open(const QString& file); data/openmsx-debugger-0.1~git20200913/src/DebuggerForm.cpp:135: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 buf[28]; data/openmsx-debugger-0.1~git20200913/src/DebuggerForm.cpp:993: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). session.open(file); data/openmsx-debugger-0.1~git20200913/src/HexViewer.cpp:394: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(previousHexData, hexData, debuggableSize); data/openmsx-debugger-0.1~git20200913/src/Settings.cpp:4: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 *DebuggerFontNames[Settings::FONT_END] = { data/openmsx-debugger-0.1~git20200913/src/SymbolTable.cpp:194:13: [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 (file.open(QIODevice::ReadOnly | QIODevice::Text)) { data/openmsx-debugger-0.1~git20200913/src/SymbolTable.cpp:279: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 (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { data/openmsx-debugger-0.1~git20200913/src/SymbolTable.cpp:313: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 (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { data/openmsx-debugger-0.1~git20200913/src/SymbolTable.cpp:357: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 (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { data/openmsx-debugger-0.1~git20200913/src/SymbolTable.cpp:380: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 (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { data/openmsx-debugger-0.1~git20200913/src/SymbolTable.cpp:408: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 (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { data/openmsx-debugger-0.1~git20200913/src/VDPCommandRegViewer.cpp:207: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 newregs[64]; data/openmsx-debugger-0.1~git20200913/src/SymbolManager.cpp:158:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read) { data/openmsx-debugger-0.1~git20200913/src/openmsx/QAbstractSocketStreamWrapper.cpp:15:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). qint64 recvd = sock->read(static_cast<char*>(buffer), cb); ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 14712 in approximately 0.36 seconds (40852 lines/second) Physical Source Lines of Code (SLOC) = 11983 Hits@level = [0] 9 [1] 2 [2] 18 [3] 3 [4] 16 [5] 0 Hits@level+ = [0+] 48 [1+] 39 [2+] 37 [3+] 19 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 4.00567 [1+] 3.25461 [2+] 3.08771 [3+] 1.58558 [4+] 1.33522 [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.