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/primus-0~20150328/libglfork.cpp

FINAL RESULTS:

data/primus-0~20150328/libglfork.cpp:22:42:  [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.
#define primus_print(c, ...) do { if (c) fprintf(stderr, "primus: " __VA_ARGS__); } while (0)
data/primus-0~20150328/libglfork.cpp:162: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.
#define getconf(V) (getenv(#V) ? getenv(#V) : V)
data/primus-0~20150328/libglfork.cpp:162: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.
#define getconf(V) (getenv(#V) ? getenv(#V) : V)
data/primus-0~20150328/libglfork.cpp:188:10:  [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("PRIMUS_DISPLAY"))
data/primus-0~20150328/libglfork.cpp:196:10:  [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("PRIMUS_libGLa"))
data/primus-0~20150328/libglfork.cpp:32: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 errors[1024], *errors_ptr = errors, *errors_end = errors + 1024;
data/primus-0~20150328/libglfork.cpp:187: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 c[256];
data/primus-0~20150328/libglfork.cpp:210:9:  [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.
	  b += sprintf(b, "%.*s/libGL.so.1", (int)(n - p), p);
data/primus-0~20150328/libglfork.cpp:254:10:  [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).
    sync(atoi(getconf(PRIMUS_SYNC))),
data/primus-0~20150328/libglfork.cpp:255:14:  [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).
    loglevel(atoi(getconf(PRIMUS_VERBOSE))),
data/primus-0~20150328/libglfork.cpp:256: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).
    dispmethod(atoi(getconf(PRIMUS_UPLOAD))),
data/primus-0~20150328/libglfork.cpp:257:15:  [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).
    autosleep(atoi(getconf(PRIMUS_SLEEP))),
data/primus-0~20150328/libglfork.cpp:323: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 buf[128], *cbuf = buf, *end = buf+128;
data/primus-0~20150328/libglfork.cpp:979:24:  [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.
    if (!strcmp((const char *)procName, redefined_names[i]))
data/primus-0~20150328/libglfork.cpp:184:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(addr.sun_path, getconf(BUMBLEBEE_SOCKET), sizeof(addr.sun_path));
data/primus-0~20150328/libglfork.cpp:190:38:  [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).
      send(sock, "Q VirtualDisplay", strlen("Q VirtualDisplay") + 1, 0);
data/primus-0~20150328/libglfork.cpp:192:35:  [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).
      die_if(memcmp(c, "Value: ", strlen("Value: ")), "unexpected query response\n");
data/primus-0~20150328/libglfork.cpp:198:35:  [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).
      send(sock, "Q LibraryPath", strlen("Q LibraryPath") + 1, 0);
data/primus-0~20150328/libglfork.cpp:200:35:  [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).
      die_if(memcmp(c, "Value: ", strlen("Value: ")), "unexpected query response\n");
data/primus-0~20150328/libglfork.cpp:206:26:  [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 *bblibs = new char[strlen(c + 7) + npaths * strlen("/libGL.so.1") + 1], *b = bblibs, *n, *p;
data/primus-0~20150328/libglfork.cpp:206:51:  [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 *bblibs = new char[strlen(c + 7) + npaths * strlen("/libGL.so.1") + 1], *b = bblibs, *n, *p;
data/primus-0~20150328/libglfork.cpp:272:65:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  void make_current(Display *dpy, GLXDrawable draw, GLXDrawable read)
data/primus-0~20150328/libglfork.cpp:276:27:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    this->read_drawable = read;
data/primus-0~20150328/libglfork.cpp:560:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(sleep_usec);
data/primus-0~20150328/libglfork.cpp:695:72:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
data/primus-0~20150328/libglfork.cpp:697:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  if (draw == read)
data/primus-0~20150328/libglfork.cpp:700:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  GLXPbuffer pb_read = lookup_pbuffer(dpy, read, ctx);
data/primus-0~20150328/libglfork.cpp:701:34:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  tsdata.make_current(dpy, draw, read);
data/primus-0~20150328/libglfork.cpp:1011: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).
    if (memmem(set2, strlen(set2), set1, p - set1))

ANALYSIS SUMMARY:

Hits = 29
Lines analyzed = 1039 in approximately 0.05 seconds (21623 lines/second)
Physical Source Lines of Code (SLOC) = 913
Hits@level = [0]   5 [1]  15 [2]   9 [3]   4 [4]   1 [5]   0
Hits@level+ = [0+]  34 [1+]  29 [2+]  14 [3+]   5 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 37.2399 [1+] 31.7634 [2+] 15.3341 [3+] 5.47645 [4+] 1.09529 [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.