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/jsonnet-0.16.0+ds/case_studies/fractal/tilegen/mandelbrot.cpp
Examining data/jsonnet-0.16.0+ds/case_studies/micro_fractal/tilegen/mandelbrot.cpp
Examining data/jsonnet-0.16.0+ds/cmd/jsonnet.cpp
Examining data/jsonnet-0.16.0+ds/cmd/jsonnetfmt.cpp
Examining data/jsonnet-0.16.0+ds/cmd/utils.cpp
Examining data/jsonnet-0.16.0+ds/cmd/utils.h
Examining data/jsonnet-0.16.0+ds/core/ast.h
Examining data/jsonnet-0.16.0+ds/core/desugarer.cpp
Examining data/jsonnet-0.16.0+ds/core/desugarer.h
Examining data/jsonnet-0.16.0+ds/core/formatter.cpp
Examining data/jsonnet-0.16.0+ds/core/formatter.h
Examining data/jsonnet-0.16.0+ds/core/json.h
Examining data/jsonnet-0.16.0+ds/core/lexer.cpp
Examining data/jsonnet-0.16.0+ds/core/lexer.h
Examining data/jsonnet-0.16.0+ds/core/lexer_test.cpp
Examining data/jsonnet-0.16.0+ds/core/libjsonnet.cpp
Examining data/jsonnet-0.16.0+ds/core/libjsonnet_test.cpp
Examining data/jsonnet-0.16.0+ds/core/libjsonnet_test_file.c
Examining data/jsonnet-0.16.0+ds/core/libjsonnet_test_snippet.c
Examining data/jsonnet-0.16.0+ds/core/parser.cpp
Examining data/jsonnet-0.16.0+ds/core/parser.h
Examining data/jsonnet-0.16.0+ds/core/parser_test.cpp
Examining data/jsonnet-0.16.0+ds/core/pass.cpp
Examining data/jsonnet-0.16.0+ds/core/pass.h
Examining data/jsonnet-0.16.0+ds/core/state.h
Examining data/jsonnet-0.16.0+ds/core/static_analysis.cpp
Examining data/jsonnet-0.16.0+ds/core/static_analysis.h
Examining data/jsonnet-0.16.0+ds/core/static_error.h
Examining data/jsonnet-0.16.0+ds/core/string_utils.cpp
Examining data/jsonnet-0.16.0+ds/core/string_utils.h
Examining data/jsonnet-0.16.0+ds/core/unicode.h
Examining data/jsonnet-0.16.0+ds/core/vm.cpp
Examining data/jsonnet-0.16.0+ds/core/vm.h
Examining data/jsonnet-0.16.0+ds/cpp/libjsonnet++.cpp
Examining data/jsonnet-0.16.0+ds/cpp/libjsonnet++_test.cpp
Examining data/jsonnet-0.16.0+ds/include/libjsonnet++.h
Examining data/jsonnet-0.16.0+ds/include/libjsonnet.h
Examining data/jsonnet-0.16.0+ds/include/libjsonnet_fmt.h
Examining data/jsonnet-0.16.0+ds/python/_jsonnet.c
Examining data/jsonnet-0.16.0+ds/stdlib/to_c_array.cpp
Examining data/jsonnet-0.16.0+ds/test_cmd/help.golden.stdout.cpp
Examining data/jsonnet-0.16.0+ds/test_cmd/max_stack4.golden.stderr.cpp
Examining data/jsonnet-0.16.0+ds/test_cmd/no_args.golden.stderr.cpp
Examining data/jsonnet-0.16.0+ds/test_cmd/simple4.golden.stderr.cpp
Examining data/jsonnet-0.16.0+ds/third_party/json/json.hpp
Examining data/jsonnet-0.16.0+ds/third_party/md5/md5.cpp
Examining data/jsonnet-0.16.0+ds/third_party/md5/md5.h

FINAL RESULTS:

data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:48:10:  [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).
    std::strcpy(r, v.c_str());
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:249:18:  [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).
            std::strcpy(r, err);
data/jsonnet-0.16.0+ds/core/libjsonnet_test_snippet.c:36:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(str, "%s%s", a, b);
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:3780:23:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
                (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(element_type));
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:5436:15:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
        (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current));
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:6862:23:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
                (std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c));
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:12372:43:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
                                    (std::snprintf)(string_buffer.data() + bytes, 7, "\\u%04x",
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:12378:43:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
                                    (std::snprintf)(string_buffer.data() + bytes, 13, "\\u%04x\\u%04x",
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:12416:35:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
                            (std::snprintf)(&sn[0], sn.size(), "%.2X", byte);
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:12510:27:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
                    (std::snprintf)(&sn[0], sn.size(), "%.2X", static_cast<std::uint8_t>(s.back()));
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:12711:36:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
        std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, x);
data/jsonnet-0.16.0+ds/cmd/jsonnet.cpp:120: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.
        const char *val_cstr = ::getenv(var.c_str());
data/jsonnet-0.16.0+ds/cmd/jsonnet.cpp:492:44:  [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 (const char *jsonnet_path_env = getenv("JSONNET_PATH")) {
data/jsonnet-0.16.0+ds/cmd/jsonnet.cpp:379: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).
        f.open(output_file.c_str());
data/jsonnet-0.16.0+ds/cmd/jsonnet.cpp:407: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).
        f.open(filename.c_str());
data/jsonnet-0.16.0+ds/cmd/jsonnet.cpp:444: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).
        f.open(output_file.c_str());
data/jsonnet-0.16.0+ds/cmd/utils.cpp:75: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).
        f.open(filename);
data/jsonnet-0.16.0+ds/cmd/utils.cpp:124: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).
        f.open(output_file.c_str());
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:213: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).
    f.open(abs_path.c_str());
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:457: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).
        f.open(filename);
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:544:21:  [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(&buf[i], pair.first.c_str(), pair.first.length() + 1);
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:546:21:  [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(&buf[i], pair.second.c_str(), pair.second.length());
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:578:21:  [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(&buf[i], doc.c_str(), doc.length());
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:627: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).
    f.open(filename);
data/jsonnet-0.16.0+ds/python/_jsonnet.c:27: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(out, str, strlen(str) + 1);
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:5379:14:  [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(&result, vec.data(), sizeof(NumberType));
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:10824:14:  [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(vec.data(), &n, sizeof(NumberType));
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:10855:14:  [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(&result, &x, sizeof(x));
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:10951: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(&target, &source, sizeof(Source));
data/jsonnet-0.16.0+ds/third_party/md5/md5.cpp:271: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(&buffer[index], input, firstpart);
data/jsonnet-0.16.0+ds/third_party/md5/md5.cpp:284: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(&buffer[index], &input[i], length-i);
data/jsonnet-0.16.0+ds/third_party/md5/md5.cpp:301:19:  [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 unsigned char padding[64] = {
data/jsonnet-0.16.0+ds/third_party/md5/md5.cpp:309: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 bits[8];
data/jsonnet-0.16.0+ds/third_party/md5/md5.cpp:341: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 buf[33];
data/jsonnet-0.16.0+ds/third_party/md5/md5.cpp:343: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(buf+i*2, "%02x", digest[i]);
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:248:57:  [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).
            char *r = jsonnet_realloc(vm, nullptr, std::strlen(err) + 1);
data/jsonnet-0.16.0+ds/core/libjsonnet.cpp:412:14:  [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 (std::strlen(path_) == 0)
data/jsonnet-0.16.0+ds/core/libjsonnet_test_snippet.c:35:24:  [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).
    char *str = malloc(strlen(a) + strlen(b) + 1);
data/jsonnet-0.16.0+ds/core/libjsonnet_test_snippet.c:35:36:  [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).
    char *str = malloc(strlen(a) + strlen(b) + 1);
data/jsonnet-0.16.0+ds/python/_jsonnet.c:26:43:  [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).
    char *out = jsonnet_realloc(vm, NULL, strlen(str) + 1);
data/jsonnet-0.16.0+ds/python/_jsonnet.c:27:22:  [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).
    memcpy(out, str, strlen(str) + 1);
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:2306:21:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        return std::fgetc(m_file);
data/jsonnet-0.16.0+ds/third_party/json/json.hpp:2611:30:  [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).
                        std::strlen(reinterpret_cast<const char*>(b))) {}

ANALYSIS SUMMARY:

Hits = 43
Lines analyzed = 37795 in approximately 0.96 seconds (39292 lines/second)
Physical Source Lines of Code (SLOC) = 23831
Hits@level = [0]   6 [1]   8 [2]  22 [3]   2 [4]  11 [5]   0
Hits@level+ = [0+]  49 [1+]  43 [2+]  35 [3+]  13 [4+]  11 [5+]   0
Hits/KSLOC@level+ = [0+] 2.05615 [1+] 1.80437 [2+] 1.46868 [3+] 0.545508 [4+] 0.461584 [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.