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/libfreehand-0.1.2/inc/libfreehand/libfreehand.h
Examining data/libfreehand-0.1.2/inc/libfreehand/FreeHandDocument.h
Examining data/libfreehand-0.1.2/src/lib/FHConstants.h
Examining data/libfreehand-0.1.2/src/lib/FHParser.cpp
Examining data/libfreehand-0.1.2/src/lib/FHTransform.h
Examining data/libfreehand-0.1.2/src/lib/FHTypes.h
Examining data/libfreehand-0.1.2/src/lib/FHCollector.h
Examining data/libfreehand-0.1.2/src/lib/FHTransform.cpp
Examining data/libfreehand-0.1.2/src/lib/FHCollector.cpp
Examining data/libfreehand-0.1.2/src/lib/FHInternalStream.h
Examining data/libfreehand-0.1.2/src/lib/FHPath.h
Examining data/libfreehand-0.1.2/src/lib/FHColorProfiles.h
Examining data/libfreehand-0.1.2/src/lib/tokenhash.h
Examining data/libfreehand-0.1.2/src/lib/FHInternalStream.cpp
Examining data/libfreehand-0.1.2/src/lib/FreeHandDocument.cpp
Examining data/libfreehand-0.1.2/src/lib/FHPath.cpp
Examining data/libfreehand-0.1.2/src/lib/tokens.h
Examining data/libfreehand-0.1.2/src/lib/FHParser.h
Examining data/libfreehand-0.1.2/src/lib/libfreehand_utils.h
Examining data/libfreehand-0.1.2/src/lib/libfreehand_utils.cpp
Examining data/libfreehand-0.1.2/src/test/test.cpp
Examining data/libfreehand-0.1.2/src/test/FHInternalStreamTest.cpp
Examining data/libfreehand-0.1.2/src/fuzz/fhfuzzer.cpp
Examining data/libfreehand-0.1.2/src/conv/text/fh2text.cpp
Examining data/libfreehand-0.1.2/src/conv/svg/fh2svg.cpp
Examining data/libfreehand-0.1.2/src/conv/raw/fh2raw.cpp

FINAL RESULTS:

data/libfreehand-0.1.2/src/lib/FHCollector.cpp:109:15:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  colorString.sprintf("#%.2x%.2x%.2x", color.m_red >> 8, color.m_green >> 8, color.m_blue >> 8);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:992:18:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        filename.sprintf("fhcontents%.4x.svg", contentId);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1179:20:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
          filename.sprintf("freehandclipgroup%.4x.svg", group->m_elementsId);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1269:14:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    filename.sprintf("freehanddump%.4x.%s", iterImage->first, iterImage->second.m_format.empty() ? "bin" : iterImage->second.m_format.cstr());
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1503:14:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        name.sprintf("Textbox%d-%d",m_textBoxNumberId,id);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1509:14:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        name.sprintf("Textbox%d-%d",m_textBoxNumberId,id+1);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1640:13:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
      value.sprintf("%g%%",100.*it->second/fontSize);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1685:11:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    value.sprintf("%g%%",100.*charProps.m_baselineShift/fontSize);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:2549:18:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        filename.sprintf("freehandtilefill%.4x.svg", tileFill->m_groupId);
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:2646:13:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  boxString.sprintf("%d %d %d %d", int(box.m_xmin*35), int(box.m_ymin*35), int(35*(box.m_xmax-box.m_xmin)), int(35*(box.m_ymax-box.m_ymin)));
data/libfreehand-0.1.2/src/lib/libfreehand_utils.cpp:59:8:  [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.
  std::vfprintf(stderr, format, args);
data/libfreehand-0.1.2/src/lib/libfreehand_utils.h:36:61:  [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.
#define FH_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:988:31:  [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.
      output.append((unsigned char *)svgOutput[0].cstr(), strlen(svgOutput[0].cstr()));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:993:19:  [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).
        FILE *f = fopen(filename.cstr(), "wb");
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1175:33:  [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.
        output.append((unsigned char *)svgOutput[0].cstr(), strlen(svgOutput[0].cstr()));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1180:21:  [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).
          FILE *f = fopen(filename.cstr(), "wb");
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1270:15:  [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).
    FILE *f = fopen(filename.cstr(), "wb");
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:2545:31:  [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.
      output.append((unsigned char *)svgOutput[0].cstr(), strlen(svgOutput[0].cstr()));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:2550:19:  [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).
        FILE *f = fopen(filename.cstr(), "wb");
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:3243: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 c(pattern[j-1]);
data/libfreehand-0.1.2/src/lib/FHInternalStream.cpp:36: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(&m_buffer[0], tmpBuffer, size);
data/libfreehand-0.1.2/src/lib/FHInternalStream.cpp:43: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 out[CHUNK];
data/libfreehand-0.1.2/src/lib/libfreehand_utils.cpp:166: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 outbuf[U8_MAX_LENGTH+1];
data/libfreehand-0.1.2/src/lib/libfreehand_utils.cpp:198: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 outbuf[U8_MAX_LENGTH+1];
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:987:72:  [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).
      librevenge::RVNGBinaryData output((const unsigned char *)header, strlen(header));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:988:59:  [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).
      output.append((unsigned char *)svgOutput[0].cstr(), strlen(svgOutput[0].cstr()));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1174:74:  [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).
        librevenge::RVNGBinaryData output((const unsigned char *)header, strlen(header));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:1175:61:  [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).
        output.append((unsigned char *)svgOutput[0].cstr(), strlen(svgOutput[0].cstr()));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:2544:72:  [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).
      librevenge::RVNGBinaryData output((const unsigned char *)header, strlen(header));
data/libfreehand-0.1.2/src/lib/FHCollector.cpp:2545:59:  [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).
      output.append((unsigned char *)svgOutput[0].cstr(), strlen(svgOutput[0].cstr()));
data/libfreehand-0.1.2/src/lib/FHInternalStream.cpp:30:45:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    const unsigned char *tmpBuffer = input->read(size, tmpNumBytesRead);
data/libfreehand-0.1.2/src/lib/FHInternalStream.cpp:56:45:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    const unsigned char *tmpBuffer = input->read(size, tmpNumBytesRead);
data/libfreehand-0.1.2/src/lib/FHInternalStream.cpp:93:53:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
const unsigned char *libfreehand::FHInternalStream::read(unsigned long numBytes, unsigned long &numBytesRead)
data/libfreehand-0.1.2/src/lib/FHInternalStream.h:50:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override;
data/libfreehand-0.1.2/src/lib/FHParser.cpp:35:58:  [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).
  const fhtoken *token = Perfect_Hash::in_word_set(name, strlen(name));
data/libfreehand-0.1.2/src/lib/FHParser.cpp:944:40:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  const unsigned char *buffer = input->read(dataSize, numBytesRead);
data/libfreehand-0.1.2/src/lib/libfreehand_utils.cpp:72:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  uint8_t const *p = input->read(sizeof(uint8_t), numBytesRead);
data/libfreehand-0.1.2/src/lib/libfreehand_utils.cpp:93:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  uint8_t const *p = input->read(sizeof(uint16_t), numBytesRead);
data/libfreehand-0.1.2/src/lib/libfreehand_utils.cpp:115:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  uint8_t const *p = input->read(sizeof(uint32_t), numBytesRead);
data/libfreehand-0.1.2/src/test/FHInternalStreamTest.cpp:60:35:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    const unsigned char *s = strm.read(1, readBytes);
data/libfreehand-0.1.2/src/test/FHInternalStreamTest.cpp:72:33:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  const unsigned char *s = strm.read(sizeof(data), readBytes);
data/libfreehand-0.1.2/src/test/FHInternalStreamTest.cpp:74:23:  [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.
  CPPUNIT_ASSERT(std::equal(data, data + sizeof(data), s));

ANALYSIS SUMMARY:

Hits = 42
Lines analyzed = 24202 in approximately 1.81 seconds (13357 lines/second)
Physical Source Lines of Code (SLOC) = 22907
Hits@level = [0]  39 [1]  18 [2]  12 [3]   0 [4]  12 [5]   0
Hits@level+ = [0+]  81 [1+]  42 [2+]  24 [3+]  12 [4+]  12 [5+]   0
Hits/KSLOC@level+ = [0+] 3.53604 [1+] 1.8335 [2+] 1.04771 [3+] 0.523857 [4+] 0.523857 [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.