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/dymo-cups-drivers-1.4.0/src/lw/LabelWriterLanguageMonitor.cpp Examining data/dymo-cups-drivers-1.4.0/src/lw/LabelWriterDriver.cpp Examining data/dymo-cups-drivers-1.4.0/src/lw/CupsFilterLabelWriter.cpp Examining data/dymo-cups-drivers-1.4.0/src/lw/LabelWriterLanguageMonitor.h Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/TestLabelWriterDriver.h Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/MOCK_LWLMPrintEnvironment.cpp Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/MOCK_LWLMPrintEnvironment.h Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/TestLabelWriterLanguageMonitor.cpp Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/TestLabelWriterFilter.cpp Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/TestLabelWriterDriver.cpp Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/TestLabelWriterLanguageMonitor.h Examining data/dymo-cups-drivers-1.4.0/src/lw/tests/TestLabelWriterFilter.h Examining data/dymo-cups-drivers-1.4.0/src/lw/LabelWriterDriver.h Examining data/dymo-cups-drivers-1.4.0/src/lw/CupsFilterLabelWriter.h Examining data/dymo-cups-drivers-1.4.0/src/lw/raster2dymolw.cpp Examining data/dymo-cups-drivers-1.4.0/src/lm/raster2dymolm.cpp Examining data/dymo-cups-drivers-1.4.0/src/lm/LabelManagerLanguageMonitor.cpp Examining data/dymo-cups-drivers-1.4.0/src/lm/CupsFilterLabelManager.cpp Examining data/dymo-cups-drivers-1.4.0/src/lm/LabelManagerDriver.h Examining data/dymo-cups-drivers-1.4.0/src/lm/LabelManagerDriver.cpp Examining data/dymo-cups-drivers-1.4.0/src/lm/tests/TestLabelManagerDriver.h Examining data/dymo-cups-drivers-1.4.0/src/lm/tests/TestLabelManagerFilter.cpp Examining data/dymo-cups-drivers-1.4.0/src/lm/tests/TestLabelManagerDriver.cpp Examining data/dymo-cups-drivers-1.4.0/src/lm/tests/TestLabelManagerFilter.h Examining data/dymo-cups-drivers-1.4.0/src/lm/LabelManagerLanguageMonitor.h Examining data/dymo-cups-drivers-1.4.0/src/lm/CupsFilterLabelManager.h Examining data/dymo-cups-drivers-1.4.0/src/common/ErrorDiffusionHalftoning.h Examining data/dymo-cups-drivers-1.4.0/src/common/Halftoning.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/ErrorDiffusionHalftoning.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/DummyLanguageMonitor.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/CommonTypedefs.h Examining data/dymo-cups-drivers-1.4.0/src/common/CupsPrintEnvironment.h Examining data/dymo-cups-drivers-1.4.0/src/common/PrinterDriver.h Examining data/dymo-cups-drivers-1.4.0/src/common/NonLinearLaplacianHalftoning.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/NonLinearLaplacianHalftoning.h Examining data/dymo-cups-drivers-1.4.0/src/common/Halftoning.h Examining data/dymo-cups-drivers-1.4.0/src/common/DummyLanguageMonitor.h Examining data/dymo-cups-drivers-1.4.0/src/common/tests/testsMain.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/tests/MOCK_PrintEnvironment.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/tests/TestNLLHalftoning.h Examining data/dymo-cups-drivers-1.4.0/src/common/tests/TestNLLHalftoning.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/tests/TestErrorDiffusionHalftoning.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/tests/MOCK_PrintEnvironment.h Examining data/dymo-cups-drivers-1.4.0/src/common/tests/TestCommon.h Examining data/dymo-cups-drivers-1.4.0/src/common/tests/TestErrorDiffusionHalftoning.h Examining data/dymo-cups-drivers-1.4.0/src/common/tests/TestCommon.cpp Examining data/dymo-cups-drivers-1.4.0/src/common/CupsFilter.h Examining data/dymo-cups-drivers-1.4.0/src/common/CupsPrintEnvironment.cpp Examining data/dymo-cups-drivers-1.4.0/samples/custom_paper/CairoUtils.h Examining data/dymo-cups-drivers-1.4.0/samples/custom_paper/CustomPaper.cpp Examining data/dymo-cups-drivers-1.4.0/samples/custom_paper_tape/CustomPaperTape.cpp Examining data/dymo-cups-drivers-1.4.0/samples/custom_paper_tape/CairoUtils.h Examining data/dymo-cups-drivers-1.4.0/samples/paper_list/PaperList.cpp Examining data/dymo-cups-drivers-1.4.0/samples/paper_bounds/PaperBounds.cpp Examining data/dymo-cups-drivers-1.4.0/samples/paper_bounds/CairoUtils.h Examining data/dymo-cups-drivers-1.4.0/samples/test_label/TestLabel.cpp Examining data/dymo-cups-drivers-1.4.0/samples/test_label/CairoUtils.h FINAL RESULTS: data/dymo-cups-drivers-1.4.0/samples/paper_bounds/PaperBounds.cpp:241: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, e.what()); data/dymo-cups-drivers-1.4.0/samples/test_label/TestLabel.cpp:224: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, e.what()); data/dymo-cups-drivers-1.4.0/src/common/CupsFilter.h:219:33: [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. ppd_file_t* ppd = ppdOpenFile(getenv("PPD")); data/dymo-cups-drivers-1.4.0/src/common/CupsPrintEnvironment.cpp:35:24: [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. const char* PrnDir = getenv("DYMO_PRN_DIR"); data/dymo-cups-drivers-1.4.0/src/common/CupsPrintEnvironment.cpp:39:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("PRINTER")) data/dymo-cups-drivers-1.4.0/src/common/CupsPrintEnvironment.cpp:40:19: [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. FileName += getenv("PRINTER"); data/dymo-cups-drivers-1.4.0/src/lm/LabelManagerLanguageMonitor.cpp:74:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char* uri = getenv("DEVICE_URI"); data/dymo-cups-drivers-1.4.0/src/lw/LabelWriterLanguageMonitor.cpp:84: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* uri = getenv("DEVICE_URI"); data/dymo-cups-drivers-1.4.0/src/lw/raster2dymolw.cpp:61:33: [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. ppd_file_t* ppd = ppdOpenFile(getenv("PPD")); data/dymo-cups-drivers-1.4.0/samples/custom_paper/CustomPaper.cpp:39: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). return atoi(c.choice); data/dymo-cups-drivers-1.4.0/samples/custom_paper/CustomPaper.cpp:150: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 PageSizeValue[250]; data/dymo-cups-drivers-1.4.0/samples/custom_paper/CustomPaper.cpp:151:5: [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(PageSizeValue, "Custom.%fx%f", CustomPaperPrintableWidth, CustomPaperPrintableHeight); data/dymo-cups-drivers-1.4.0/samples/custom_paper_tape/CustomPaperTape.cpp:39: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). return atoi(c.choice); data/dymo-cups-drivers-1.4.0/samples/custom_paper_tape/CustomPaperTape.cpp:150: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 PageSizeValue[250]; data/dymo-cups-drivers-1.4.0/samples/custom_paper_tape/CustomPaperTape.cpp:151:5: [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(PageSizeValue, "Custom.%fx%f", CustomPaperPrintableWidth, CustomPaperPrintableHeight); data/dymo-cups-drivers-1.4.0/samples/paper_bounds/PaperBounds.cpp:42: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). return atoi(c.choice); data/dymo-cups-drivers-1.4.0/src/common/CupsFilter.h:83:15: [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(argv[6], O_RDONLY)) == -1) data/dymo-cups-drivers-1.4.0/src/common/CupsPrintEnvironment.cpp:44:16: [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). PRNFile_ = fopen(FileName.c_str(), "w+b"); data/dymo-cups-drivers-1.4.0/src/lm/CupsFilterLabelManager.cpp:59:40: [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). Driver.SetPrintChainMarksAtDocEnd((atoi(choice->choice))); data/dymo-cups-drivers-1.4.0/src/lm/CupsFilterLabelManager.cpp:67:32: [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). Driver.SetContinuousPaper((atoi(choice->choice))); data/dymo-cups-drivers-1.4.0/src/lm/CupsFilterLabelManager.cpp:75:60: [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). Driver.SetTapeColor(CLabelManagerDriver::tape_color_t((atoi(choice->choice)))); data/dymo-cups-drivers-1.4.0/src/lm/tests/TestLabelManagerFilter.cpp:151:7: [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[10]; data/dymo-cups-drivers-1.4.0/src/lm/tests/TestLabelManagerFilter.cpp:152:7: [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, "%i", i); data/dymo-cups-drivers-1.4.0/samples/paper_bounds/PaperBounds.cpp:195:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((ch = getchar()) == '\n') {} data/dymo-cups-drivers-1.4.0/samples/test_label/TestLabel.cpp:195:10: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getchar(); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 9372 in approximately 1.64 seconds (5705 lines/second) Physical Source Lines of Code (SLOC) = 5928 Hits@level = [0] 52 [1] 2 [2] 14 [3] 7 [4] 2 [5] 0 Hits@level+ = [0+] 77 [1+] 25 [2+] 23 [3+] 9 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 12.9892 [1+] 4.21727 [2+] 3.87989 [3+] 1.51822 [4+] 0.337382 [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.