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/libpthread-workqueue-0.9.1/src/api.c
Examining data/libpthread-workqueue-0.9.1/src/witem_cache.c
Examining data/libpthread-workqueue-0.9.1/src/thread_rt.h
Examining data/libpthread-workqueue-0.9.1/src/linux/platform.h
Examining data/libpthread-workqueue-0.9.1/src/linux/thread_info.c
Examining data/libpthread-workqueue-0.9.1/src/linux/load.c
Examining data/libpthread-workqueue-0.9.1/src/linux/thread_rt.c
Examining data/libpthread-workqueue-0.9.1/src/private.h
Examining data/libpthread-workqueue-0.9.1/src/thread_info.h
Examining data/libpthread-workqueue-0.9.1/src/debug.h
Examining data/libpthread-workqueue-0.9.1/src/posix/platform.h
Examining data/libpthread-workqueue-0.9.1/src/posix/thread_info.c
Examining data/libpthread-workqueue-0.9.1/src/posix/manager.c
Examining data/libpthread-workqueue-0.9.1/src/posix/thread_rt.c
Examining data/libpthread-workqueue-0.9.1/testing/api/test.c
Examining data/libpthread-workqueue-0.9.1/testing/api/posix_semaphore.h
Examining data/libpthread-workqueue-0.9.1/testing/latency/latency.c
Examining data/libpthread-workqueue-0.9.1/testing/latency/latency.h
Examining data/libpthread-workqueue-0.9.1/testing/witem_cache/test.c
Examining data/libpthread-workqueue-0.9.1/include/pthread_workqueue.h

FINAL RESULTS:

data/libpthread-workqueue-0.9.1/src/linux/thread_info.c:143:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(thread_path, "%s/%s/stat",task_path, dit->d_name);
data/libpthread-workqueue-0.9.1/src/linux/thread_info.c:147:17:  [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(thread_data, "%d %s %c", &pid, dummy, &state) == 3)
data/libpthread-workqueue-0.9.1/testing/api/test.c:38:38:  [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 dbg_printf(fmt,...) if (dbg) fprintf(stderr, fmt, __VA_ARGS__)
data/libpthread-workqueue-0.9.1/src/api.c:65:24:  [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.
    DEBUG_WORKQUEUE = (getenv("PWQ_DEBUG") == NULL) ? 0 : 1;
data/libpthread-workqueue-0.9.1/src/api.c:69:23:  [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.
    PWQ_RT_THREADS = (getenv("PWQ_RT_THREADS") == NULL) ? 0 : 1;
data/libpthread-workqueue-0.9.1/src/api.c:70:23:  [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.
    PWQ_ACTIVE_CPU = (getenv("PWQ_ACTIVE_CPU") == NULL) ? 0 : atoi(getenv("PWQ_ACTIVE_CPU"));
data/libpthread-workqueue-0.9.1/src/api.c:70:68:  [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.
    PWQ_ACTIVE_CPU = (getenv("PWQ_ACTIVE_CPU") == NULL) ? 0 : atoi(getenv("PWQ_ACTIVE_CPU"));
data/libpthread-workqueue-0.9.1/src/api.c:72:9:  [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("PWQ_SPIN_THREADS") != NULL)
data/libpthread-workqueue-0.9.1/src/api.c:73: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.
        PWQ_SPIN_THREADS =  atoi(getenv("PWQ_SPIN_THREADS"));
data/libpthread-workqueue-0.9.1/testing/api/test.c:117:11:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    sleep(random() % 6);
data/libpthread-workqueue-0.9.1/src/api.c:70:63:  [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).
    PWQ_ACTIVE_CPU = (getenv("PWQ_ACTIVE_CPU") == NULL) ? 0 : atoi(getenv("PWQ_ACTIVE_CPU"));
data/libpthread-workqueue-0.9.1/src/api.c:73:29:  [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).
        PWQ_SPIN_THREADS =  atoi(getenv("PWQ_SPIN_THREADS"));
data/libpthread-workqueue-0.9.1/src/linux/load.c:43: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[100];
data/libpthread-workqueue-0.9.1/src/linux/load.c:47:10:  [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).
    fd = open("/proc/loadavg", O_RDONLY | O_CLOEXEC);
data/libpthread-workqueue-0.9.1/src/linux/load.c:70:12:  [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).
    nkse = atoi(p + 1);
data/libpthread-workqueue-0.9.1/src/linux/load.c:82: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[16384];
data/libpthread-workqueue-0.9.1/src/linux/load.c:87:10:  [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).
    fd = open("/proc/stat", O_RDONLY);
data/libpthread-workqueue-0.9.1/src/linux/load.c:104:18:  [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).
        runqsz = atoi(p + 14);
data/libpthread-workqueue-0.9.1/src/linux/thread_info.c:80:15:  [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).
    read_fd = open(path, O_RDONLY);
data/libpthread-workqueue-0.9.1/src/linux/thread_info.c:124: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 thread_path[1024];
data/libpthread-workqueue-0.9.1/src/linux/thread_info.c:125: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 thread_data[MAX_RESULT_SIZE+1];
data/libpthread-workqueue-0.9.1/src/linux/thread_info.c:126: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 dummy[MAX_RESULT_SIZE+1];
data/libpthread-workqueue-0.9.1/src/posix/manager.c:192:4:  [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[80];
data/libpthread-workqueue-0.9.1/src/posix/manager.c:198:9:  [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).
   fd = open("/proc/loadavg", O_RDONLY);
data/libpthread-workqueue-0.9.1/testing/api/test.c:159: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[16];
data/libpthread-workqueue-0.9.1/testing/api/test.c:162: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.
        sprintf(buf, "%d", i);
data/libpthread-workqueue-0.9.1/src/linux/load.c:53:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    len = read(fd, &buf, sizeof(buf));
data/libpthread-workqueue-0.9.1/src/linux/load.c:94:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    len = read(fd, &buf, sizeof(buf) - 1);
data/libpthread-workqueue-0.9.1/src/linux/thread_info.c:94:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    actual_read = read(read_fd, result, MAX_RESULT_SIZE);
data/libpthread-workqueue-0.9.1/src/posix/manager.c:202:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
   len = read(fd, &buf, sizeof(buf));

ANALYSIS SUMMARY:

Hits = 30
Lines analyzed = 3202 in approximately 0.10 seconds (30858 lines/second)
Physical Source Lines of Code (SLOC) = 2025
Hits@level = [0]  40 [1]   4 [2]  16 [3]   7 [4]   3 [5]   0
Hits@level+ = [0+]  70 [1+]  30 [2+]  26 [3+]  10 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 34.5679 [1+] 14.8148 [2+] 12.8395 [3+] 4.93827 [4+] 1.48148 [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.