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/libwhereami-0.0~git20200503.e07bc35/example/executable.c
Examining data/libwhereami-0.0~git20200503.e07bc35/example/library.c
Examining data/libwhereami-0.0~git20200503.e07bc35/src/whereami.h
Examining data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c

FINAL RESULTS:

data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:274:11:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
      if (sscanf(buffer, "%" PRIx64 "-%" PRIx64 " %s %" PRIx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8)
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:201:16:  [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.
    resolved = realpath(WAI_PROC_SELF_EXE, buffer);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:281: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.
          resolved = realpath(path, buffer);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:388:16:  [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.
    resolved = realpath(path, buffer2);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:434:18:  [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.
      resolved = realpath(info.dli_fname, buffer);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:495:16:  [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.
    resolved = realpath(buffer1, buffer2);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:540:18:  [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.
      resolved = realpath(info.dli_fname, buffer);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:602:16:  [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.
    resolved = realpath(path, buffer2);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:648:18:  [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.
      resolved = realpath(info.dli_fname, buffer);
data/libwhereami-0.0~git20200503.e07bc35/example/executable.c:22:3:  [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 buffer[MAX_PATH];
data/libwhereami-0.0~git20200503.e07bc35/example/executable.c:24:7:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  if (MultiByteToWideChar(CP_UTF8, 0, fileName, -1, buffer, sizeof(buffer) / sizeof(*buffer)))
data/libwhereami-0.0~git20200503.e07bc35/example/executable.c:26:5:  [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 buffer_[MAX_PATH];
data/libwhereami-0.0~git20200503.e07bc35/example/executable.c:49:12:  [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 char message[1024];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:67:3:  [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 buffer1[MAX_PATH];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:68:3:  [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 buffer2[MAX_PATH];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:195: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 buffer[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:208: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.
      memcpy(out, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:257:12:  [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).
    maps = fopen(WAI_PROC_SELF_MAPS, "r");
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:263: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 buffer[PATH_MAX < 1024 ? 1024 : PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:265: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 perms[5];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:268: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 path[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:293:22:  [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).
            int fd = open(path, O_RDONLY);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:308:19:  [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[length], "!/", 2);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:309:19:  [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[length + 2], p + 30, length_);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:325:13:  [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, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:372: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 buffer1[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:373: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 buffer2[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:395: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.
      memcpy(out, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:424: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 buffer[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:441: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.
        memcpy(out, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:480: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 buffer1[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:481: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 buffer2[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:488: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).
    self_exe = fopen(WAI_PROC_SELF_EXE, "r");
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:502: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.
      memcpy(out, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:530: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 buffer[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:547: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.
        memcpy(out, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:584: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 buffer1[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:585: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 buffer2[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:609: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.
      memcpy(out, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:638: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 buffer[PATH_MAX];
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:655: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.
        memcpy(out, resolved, length);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:105:20:  [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).
    length_ = (int)wcslen(buffer2);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:205:19:  [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).
    length = (int)strlen(resolved);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:285:25:  [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).
          length = (int)strlen(resolved);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:392:19:  [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).
    length = (int)strlen(resolved);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:438:21:  [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).
      length = (int)strlen(resolved);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:499:19:  [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).
    length = (int)strlen(resolved);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:544:21:  [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).
      length = (int)strlen(resolved);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:606:19:  [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).
    length = (int)strlen(resolved);
data/libwhereami-0.0~git20200503.e07bc35/src/whereami.c:652:21:  [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).
      length = (int)strlen(resolved);

ANALYSIS SUMMARY:

Hits = 50
Lines analyzed = 963 in approximately 0.04 seconds (25522 lines/second)
Physical Source Lines of Code (SLOC) = 740
Hits@level = [0]  16 [1]   9 [2]  32 [3]   8 [4]   1 [5]   0
Hits@level+ = [0+]  66 [1+]  50 [2+]  41 [3+]   9 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 89.1892 [1+] 67.5676 [2+] 55.4054 [3+] 12.1622 [4+] 1.35135 [5+]   0
Dot directories skipped = 2 (--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.