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/opam-2.0.5/src/stubs/opamWindows.c
Examining data/opam-2.0.5/src/stubs/opamInject.c
Examining data/opam-2.0.5/src/tools/opam-putenv.c

FINAL RESULTS:

data/opam-2.0.5/src/stubs/opamInject.c:77: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(payload.lpName, key);
data/opam-2.0.5/src/stubs/opamInject.c:78: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(payload.lpValue, val);
data/opam-2.0.5/src/stubs/opamInject.c:21:3:  [2] (buffer) TCHAR:
  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.
  TCHAR lpName[4096];
data/opam-2.0.5/src/stubs/opamInject.c:22:3:  [2] (buffer) TCHAR:
  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.
  TCHAR lpValue[4096];
data/opam-2.0.5/src/stubs/opamWindows.c:627:3:  [2] (buffer) TCHAR:
  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.
  TCHAR szPath[MAX_PATH];
data/opam-2.0.5/src/tools/opam-putenv.c:41:17:  [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).
    DWORD pid = atoi(argv[1]);
data/opam-2.0.5/src/stubs/opamWindows.c:387: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).
              cbData = strlen(buf) + 1;
data/opam-2.0.5/src/stubs/opamWindows.c:579:12:  [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).
  else if (strlen(result) == 0)
data/opam-2.0.5/src/tools/opam-putenv.c:52:15:  [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).
          key[strlen(key) - 1] = value[strlen(value) - 1] = '\0';
data/opam-2.0.5/src/tools/opam-putenv.c:52:40:  [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).
          key[strlen(key) - 1] = value[strlen(value) - 1] = '\0';

ANALYSIS SUMMARY:

Hits = 10
Lines analyzed = 986 in approximately 0.10 seconds (10003 lines/second)
Physical Source Lines of Code (SLOC) = 713
Hits@level = [0]   1 [1]   4 [2]   4 [3]   0 [4]   2 [5]   0
Hits@level+ = [0+]  11 [1+]  10 [2+]   6 [3+]   2 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 15.4278 [1+] 14.0252 [2+] 8.41515 [3+] 2.80505 [4+] 2.80505 [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.