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/gimagereader-3.3.1/common/CCITTFax4Encoder.cc Examining data/gimagereader-3.3.1/common/PaperSize.cc Examining data/gimagereader-3.3.1/gtk/src/Acquirer.cc Examining data/gimagereader-3.3.1/gtk/src/Config.cc Examining data/gimagereader-3.3.1/gtk/src/ConfigSettings.cc Examining data/gimagereader-3.3.1/gtk/src/CrashHandler.cc Examining data/gimagereader-3.3.1/gtk/src/DisplayRenderer.cc Examining data/gimagereader-3.3.1/gtk/src/Displayer.cc Examining data/gimagereader-3.3.1/gtk/src/DisplayerToolSelect.cc Examining data/gimagereader-3.3.1/gtk/src/DjVuDocument.cc Examining data/gimagereader-3.3.1/gtk/src/FileDialogs.cc Examining data/gimagereader-3.3.1/gtk/src/FontComboBox.cc Examining data/gimagereader-3.3.1/gtk/src/Image.cc Examining data/gimagereader-3.3.1/gtk/src/MainWindow.cc Examining data/gimagereader-3.3.1/gtk/src/OutputBuffer.cc Examining data/gimagereader-3.3.1/gtk/src/OutputEditorText.cc Examining data/gimagereader-3.3.1/gtk/src/Recognizer.cc Examining data/gimagereader-3.3.1/gtk/src/SearchReplaceFrame.cc Examining data/gimagereader-3.3.1/gtk/src/SourceManager.cc Examining data/gimagereader-3.3.1/gtk/src/SubstitutionsManager.cc Examining data/gimagereader-3.3.1/gtk/src/TessdataManager.cc Examining data/gimagereader-3.3.1/gtk/src/hocr/DisplayerToolHOCR.cc Examining data/gimagereader-3.3.1/gtk/src/hocr/HOCRDocument.cc Examining data/gimagereader-3.3.1/gtk/src/hocr/HOCROdtExporter.cc Examining data/gimagereader-3.3.1/gtk/src/hocr/HOCRPdfExporter.cc Examining data/gimagereader-3.3.1/gtk/src/hocr/HOCRTextExporter.cc Examining data/gimagereader-3.3.1/gtk/src/hocr/OutputEditorHOCR.cc Examining data/gimagereader-3.3.1/gtk/src/hocr/XmlUtils.cc Examining data/gimagereader-3.3.1/gtk/src/scanner/ScannerSane.cc Examining data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc Examining data/gimagereader-3.3.1/gtk/src/main.cc Examining data/gimagereader-3.3.1/gtk/src/Utils.cc Examining data/gimagereader-3.3.1/qt/src/Acquirer.cc Examining data/gimagereader-3.3.1/qt/src/Config.cc Examining data/gimagereader-3.3.1/qt/src/ConfigSettings.cc Examining data/gimagereader-3.3.1/qt/src/CrashHandler.cc Examining data/gimagereader-3.3.1/qt/src/DisplayRenderer.cc Examining data/gimagereader-3.3.1/qt/src/Displayer.cc Examining data/gimagereader-3.3.1/qt/src/DisplayerToolSelect.cc Examining data/gimagereader-3.3.1/qt/src/DjVuDocument.cc Examining data/gimagereader-3.3.1/qt/src/FileDialogs.cc Examining data/gimagereader-3.3.1/qt/src/MainWindow.cc Examining data/gimagereader-3.3.1/qt/src/OutputEditor.cc Examining data/gimagereader-3.3.1/qt/src/OutputEditorText.cc Examining data/gimagereader-3.3.1/qt/src/OutputTextEdit.cc Examining data/gimagereader-3.3.1/qt/src/Recognizer.cc Examining data/gimagereader-3.3.1/qt/src/Scanner.cc Examining data/gimagereader-3.3.1/qt/src/SearchReplaceFrame.cc Examining data/gimagereader-3.3.1/qt/src/SourceManager.cc Examining data/gimagereader-3.3.1/qt/src/SubstitutionsManager.cc Examining data/gimagereader-3.3.1/qt/src/TessdataManager.cc Examining data/gimagereader-3.3.1/qt/src/Utils.cc Examining data/gimagereader-3.3.1/qt/src/hocr/DisplayerToolHOCR.cc Examining data/gimagereader-3.3.1/qt/src/hocr/HOCRDocument.cc Examining data/gimagereader-3.3.1/qt/src/hocr/HOCROdtExporter.cc Examining data/gimagereader-3.3.1/qt/src/hocr/HOCRPdfExporter.cc Examining data/gimagereader-3.3.1/qt/src/hocr/HOCRTextExporter.cc Examining data/gimagereader-3.3.1/qt/src/hocr/OutputEditorHOCR.cc Examining data/gimagereader-3.3.1/qt/src/main.cc Examining data/gimagereader-3.3.1/qt/src/scanner/ScannerSane.cc Examining data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc FINAL RESULTS: data/gimagereader-3.3.1/gtk/src/Utils.cc:434:2: [4] (shell) ShellExecute: 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. ShellExecute(nullptr, "open", uri.c_str(), nullptr, nullptr, SW_SHOWNORMAL); data/gimagereader-3.3.1/qt/src/MainWindow.cc:310:30: [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. QString language = QLocale::system().name().left(2); data/gimagereader-3.3.1/qt/src/Utils.cc:215:29: [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. QString syslang = QLocale::system().name(); data/gimagereader-3.3.1/qt/src/main.cc:51:28: [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. qputenv("LANG", QLocale::system().name().toLocal8Bit()); data/gimagereader-3.3.1/qt/src/main.cc:60:37: [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. qtTranslator.load("qt_" + QLocale::system().name(), translationsPath); data/gimagereader-3.3.1/qt/src/main.cc:61:41: [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. qtTranslator.load("qtbase_" + QLocale::system().name(), translationsPath); data/gimagereader-3.3.1/gtk/src/FileDialogs.cc:252:26: [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. Glib::ustring(Glib::getenv("XDG_CURRENT_DESKTOP")).lowercase() == "kde" && data/gimagereader-3.3.1/gtk/src/MainWindow.cc:78:35: [3] (buffer) g_get_home_dir: This function is synonymous with 'getenv("HOME")';it returns untrustable input if the environment can beset by an attacker. It 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. filename = Glib::build_filename(g_get_home_dir(), Glib::ustring::compose("%1_crash-save.txt", PACKAGE_NAME)); data/gimagereader-3.3.1/gtk/src/MainWindow.cc:82:36: [3] (buffer) g_get_home_dir: This function is synonymous with 'getenv("HOME")';it returns untrustable input if the environment can beset by an attacker. It 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. filename = Glib::build_filename(g_get_home_dir(), Glib::ustring::compose("%1_crash-save_%2.txt", PACKAGE_NAME, i)); data/gimagereader-3.3.1/gtk/src/MainWindow.cc:319: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. std::string language = Glib::getenv("LANG").substr(0, 2); data/gimagereader-3.3.1/gtk/src/Utils.cc:135:22: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char* realabspath = realpath(abspath.c_str(), nullptr); data/gimagereader-3.3.1/gtk/src/Utils.cc:395:34: [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. Glib::ustring syslocale = Glib::getenv("LANG"); data/gimagereader-3.3.1/gtk/src/main.cc:90:11: [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(Glib::getenv("LANG").empty()) { data/gimagereader-3.3.1/gtk/src/CrashHandler.cc:28:16: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). m_pid = std::atoi(argv[2]); data/gimagereader-3.3.1/gtk/src/CrashHandler.cc:31:27: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). m_tesseractCrash = std::atoi(argv[3]); data/gimagereader-3.3.1/gtk/src/FileDialogs.cc:68:2: [2] (buffer) wchar_t: 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. wchar_t wfile[1024] = {}; data/gimagereader-3.3.1/gtk/src/FileDialogs.cc:114:2: [2] (buffer) wchar_t: 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. wchar_t wfile[MAX_PATH] = {}; data/gimagereader-3.3.1/gtk/src/MainWindow.cc:420:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[16] = {}; data/gimagereader-3.3.1/gtk/src/TessdataManager.cc:122:45: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int tagVer = TESSERACT_MAKE_VERSION(std::atoi(matchInfo.fetch(1).c_str()), std::atoi(matchInfo.fetch(2).c_str()), std::atoi(matchInfo.fetch(3).c_str())); data/gimagereader-3.3.1/gtk/src/TessdataManager.cc:122:84: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int tagVer = TESSERACT_MAKE_VERSION(std::atoi(matchInfo.fetch(1).c_str()), std::atoi(matchInfo.fetch(2).c_str()), std::atoi(matchInfo.fetch(3).c_str())); data/gimagereader-3.3.1/gtk/src/TessdataManager.cc:122:123: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int tagVer = TESSERACT_MAKE_VERSION(std::atoi(matchInfo.fetch(1).c_str()), std::atoi(matchInfo.fetch(2).c_str()), std::atoi(matchInfo.fetch(3).c_str())); data/gimagereader-3.3.1/gtk/src/Utils.cc:304:22: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). return match ? std::atoi(str.c_str()) : 0; data/gimagereader-3.3.1/gtk/src/hocr/HOCRDocument.cc:1035:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). m_pageNr = std::atoi(m_titleAttrs["ppageno"].c_str()); data/gimagereader-3.3.1/gtk/src/hocr/HOCRDocument.cc:1038:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). m_pageNr = std::atoi(m_titleAttrs["pageno"].c_str()); data/gimagereader-3.3.1/gtk/src/hocr/HOCRDocument.cc:1043:22: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). m_resolution = std::atoi(m_titleAttrs["res"].c_str()); data/gimagereader-3.3.1/gtk/src/hocr/HOCROdtExporter.cc:57: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. std::memcpy(copy, data, len); data/gimagereader-3.3.1/gtk/src/hocr/HOCROdtExporter.cc:364: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 uuidBuff[36]; data/gimagereader-3.3.1/gtk/src/hocr/OutputEditorHOCR.cc:337:43: [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). CONNECT(ui.buttonOpen, clicked, [this] { open(); }); data/gimagereader-3.3.1/gtk/src/hocr/OutputEditorHOCR.cc:922:24: [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 OutputEditorHOCR::open() { data/gimagereader-3.3.1/gtk/src/main.cc:63:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[MAX_PATH]; data/gimagereader-3.3.1/gtk/src/scanner/ScannerSane.cc:485:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(&m_job->imgbuf[offset], &m_job->lineBuffer[0], m_job->lineBuffer.size()); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:65: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. std::memcpy(bmpData, &bmpFIH, sizeof(BITMAPFILEHEADER)); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:66: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. std::memcpy(bmpData + sizeof(BITMAPFILEHEADER), pDIB, imageSize); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:421: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. std::memcpy(&val->Item, &cap.data, TWTY_Size[cap.type]); data/gimagereader-3.3.1/qt/src/MainWindow.cc:562: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). if(file.open(QIODevice::WriteOnly)) { data/gimagereader-3.3.1/qt/src/OutputEditorText.cc:245:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!file.open(QIODevice::WriteOnly)) { data/gimagereader-3.3.1/qt/src/SourceManager.cc:255:17: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). QTemporaryFile tmpfile(QDir::temp().absoluteFilePath("gimagereader_XXXXXX.png")); data/gimagereader-3.3.1/qt/src/SourceManager.cc:256:6: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(!tmpfile.open()) { data/gimagereader-3.3.1/qt/src/SourceManager.cc:256: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). if(!tmpfile.open()) { data/gimagereader-3.3.1/qt/src/SourceManager.cc:259:3: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tmpfile.setAutoRemove(false); data/gimagereader-3.3.1/qt/src/SourceManager.cc:260:14: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). filename = tmpfile.fileName(); data/gimagereader-3.3.1/qt/src/SubstitutionsManager.cc:111: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)) { data/gimagereader-3.3.1/qt/src/SubstitutionsManager.cc:148:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!file.open(QIODevice::WriteOnly)) { data/gimagereader-3.3.1/qt/src/TessdataManager.cc:290:35: [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(data.isEmpty() || !file.open(QIODevice::WriteOnly)) { data/gimagereader-3.3.1/qt/src/hocr/HOCROdtExporter.cc:60:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!zip.open( QuaZip::mdCreate )) { data/gimagereader-3.3.1/qt/src/hocr/HOCROdtExporter.cc:88: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). mimetype->open(QIODevice::WriteOnly, QuaZipNewInfo("mimetype")); data/gimagereader-3.3.1/qt/src/hocr/HOCROdtExporter.cc:94: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). manifest->open(QIODevice::WriteOnly, QuaZipNewInfo("META-INF/manifest.xml")); data/gimagereader-3.3.1/qt/src/hocr/HOCROdtExporter.cc:121: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). content->open(QIODevice::WriteOnly, QuaZipNewInfo("content.xml")); data/gimagereader-3.3.1/qt/src/hocr/HOCROdtExporter.cc:276: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::WriteOnly, QuaZipNewInfo(filename))) { data/gimagereader-3.3.1/qt/src/hocr/HOCRPdfExporter.cc:262:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(buf.data() + y * bytesPerLine, img.scanLine(y), bytesPerLine); data/gimagereader-3.3.1/qt/src/hocr/HOCRTextExporter.cc:46:17: [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(!outputFile.open(QIODevice::WriteOnly)) { data/gimagereader-3.3.1/qt/src/hocr/OutputEditorHOCR.cc:239:63: [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). connect(ui.actionOutputOpen, SIGNAL(triggered()), this, SLOT(open())); data/gimagereader-3.3.1/qt/src/hocr/OutputEditorHOCR.cc:791:24: [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 OutputEditorHOCR::open() { data/gimagereader-3.3.1/qt/src/hocr/OutputEditorHOCR.cc:801:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!file.open(QIODevice::ReadOnly)) { data/gimagereader-3.3.1/qt/src/hocr/OutputEditorHOCR.cc:838:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!file.open(QIODevice::WriteOnly)) { data/gimagereader-3.3.1/qt/src/main.cc:70:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int pid = std::atoi(argv[2]); data/gimagereader-3.3.1/qt/src/main.cc:71:29: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int tesseractCrash = std::atoi(argv[3]); data/gimagereader-3.3.1/qt/src/scanner/ScannerSane.cc:485:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(&m_job->imgbuf[offset], &m_job->lineBuffer[0], m_job->lineBuffer.size()); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:66: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. std::memcpy(bmpData, &bmpFIH, sizeof(BITMAPFILEHEADER)); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:67: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. std::memcpy(bmpData + sizeof(BITMAPFILEHEADER), pDIB, imageSize); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:423: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. std::memcpy(&val->Item, &cap.data, TWTY_Size[cap.type]); data/gimagereader-3.3.1/gtk/src/FileDialogs.cc:95:18: [1] (buffer) wcslen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = wcslen(ofn.lpstrFile + offset); data/gimagereader-3.3.1/gtk/src/FileDialogs.cc:115:2: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(wfile, suggestedName.c_str(), sizeof(wfile) / sizeof(wfile[0])); data/gimagereader-3.3.1/gtk/src/MainWindow.cc:423:53: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Glib::RefPtr<Gio::FileInputStream> stream = file->read(); data/gimagereader-3.3.1/gtk/src/MainWindow.cc:424:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). stream->read(buf, 16); data/gimagereader-3.3.1/gtk/src/OutputEditorText.cc:222:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void OutputEditorText::read(tesseract::TessBaseAPI& tess, ReadSessionData* data) { data/gimagereader-3.3.1/gtk/src/Recognizer.cc:490:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). MAIN->getOutputEditor()->read(tess, readSessionData); data/gimagereader-3.3.1/gtk/src/Recognizer.cc:528:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). MAIN->getOutputEditor()->read(tess, readSessionData); data/gimagereader-3.3.1/gtk/src/hocr/OutputEditorHOCR.cc:421:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void OutputEditorHOCR::read(tesseract::TessBaseAPI& tess, ReadSessionData* data) { data/gimagereader-3.3.1/gtk/src/scanner/ScannerSane.cc:191:39: [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). option->name != nullptr && std::strlen(option->name) > 0 data/gimagereader-3.3.1/gtk/src/scanner/ScannerSane.cc:655:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(v, value.c_str(), value.size() + 1); data/gimagereader-3.3.1/gtk/src/scanner/ScannerSane.cc:685: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). if(option->name && std::strlen(option->name) > 0) { data/gimagereader-3.3.1/gtk/src/scanner/ScannerSane.cc:689:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(option->title && std::strlen(option->title) > 0) { data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:126:7: [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. std::strncpy(m_appID.Version.Info, "TWAIN Interface", sizeof(m_appID.Version.Info)); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:127:7: [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. std::strncpy(m_appID.ProductName, "TWAIN Interface", sizeof(m_appID.ProductName)); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:128:7: [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. std::strncpy(m_appID.Manufacturer, "Sandro Mani", sizeof(m_appID.Manufacturer)); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:129:7: [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. std::strncpy(m_appID.ProductFamily, "Sandro Mani", sizeof(m_appID.ProductFamily)); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:192:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(m_srcID.ProductName, params.device.c_str(), sizeof(m_srcID.ProductName)); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:215:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(xferFile.FileName, params.filename.c_str(), sizeof(xferFile.FileName)); data/gimagereader-3.3.1/gtk/src/scanner/ScannerTwain.cc:224:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(xferFile.FileName, params.filename.c_str(), sizeof(xferFile.FileName)); data/gimagereader-3.3.1/qt/src/DisplayRenderer.cc:81:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return reader.read().convertToFormat(QImage::Format_RGB32); data/gimagereader-3.3.1/qt/src/OutputEditorText.cc:187:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void OutputEditorText::read(tesseract::TessBaseAPI& tess, ReadSessionData* data) { data/gimagereader-3.3.1/qt/src/Recognizer.cc:481:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). MAIN->getOutputEditor()->read(tess, readSessionData); data/gimagereader-3.3.1/qt/src/Recognizer.cc:518:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). MAIN->getOutputEditor()->read(tess, readSessionData); data/gimagereader-3.3.1/qt/src/hocr/OutputEditorHOCR.cc:303:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void OutputEditorHOCR::read(tesseract::TessBaseAPI& tess, ReadSessionData* data) { data/gimagereader-3.3.1/qt/src/scanner/ScannerSane.cc:191:39: [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). option->name != nullptr && std::strlen(option->name) > 0 data/gimagereader-3.3.1/qt/src/scanner/ScannerSane.cc:652:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(v, val.data(), val.size() + 1); data/gimagereader-3.3.1/qt/src/scanner/ScannerSane.cc:682: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). if(option->name && std::strlen(option->name) > 0) { data/gimagereader-3.3.1/qt/src/scanner/ScannerSane.cc:686:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(option->title && std::strlen(option->title) > 0) { data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:118:7: [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. std::strncpy(m_appID.Version.Info, "TWAIN Interface", sizeof(m_appID.Version.Info)); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:119:7: [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. std::strncpy(m_appID.ProductName, "TWAIN Interface", sizeof(m_appID.ProductName)); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:120:7: [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. std::strncpy(m_appID.Manufacturer, "Sandro Mani", sizeof(m_appID.Manufacturer)); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:121:7: [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. std::strncpy(m_appID.ProductFamily, "Sandro Mani", sizeof(m_appID.ProductFamily)); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:184:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(m_srcID.ProductName, params.device.toLocal8Bit().data(), sizeof(m_srcID.ProductName)); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:207:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(xferFile.FileName, params.filename.toLocal8Bit().data(), sizeof(xferFile.FileName)); data/gimagereader-3.3.1/qt/src/scanner/ScannerTwain.cc:216:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(xferFile.FileName, params.filename.toLocal8Bit().data(), sizeof(xferFile.FileName)); ANALYSIS SUMMARY: Hits = 96 Lines analyzed = 22026 in approximately 0.75 seconds (29324 lines/second) Physical Source Lines of Code (SLOC) = 18457 Hits@level = [0] 0 [1] 35 [2] 48 [3] 7 [4] 6 [5] 0 Hits@level+ = [0+] 96 [1+] 96 [2+] 61 [3+] 13 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 5.20128 [1+] 5.20128 [2+] 3.30498 [3+] 0.70434 [4+] 0.32508 [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.