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/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_work.c Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.h Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jittersamples.c Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_sysinfo.c Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_samples_hdf5.c Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_plugin.c Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c Examining data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_samples_csv.c FINAL RESULTS: data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:126:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stdout, fmt, ap); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_work.c:32:8: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. err = execl("/bin/sh", "sh", "-c", cmd, (char *)0); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:144:8: [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. len = snprintf(buf, 128, "Hit latency %" PRIu64, diff); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:182:4: [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. fprintf(f, " \"%u\": %" PRIu64,j, s[i].hist[j]); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:224:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(VT100_CURSOR_UP, num_threads); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.h:45:24: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((format(printf, 2, 3))); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.h:47:24: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((format(printf, 1, 2))); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.h:58:2: [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. fprintf(stderr, fmt "\n", ## arg); \ data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:544:7: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long(argc, argv, "c:n:sp:vD:l:b:Ni:o:a:h", long_options, data/jitterdebugger-0.3.1+git20200117.b90ff3a/jittersamples.c:144:7: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long(argc, argv, "hf:l:", long_options, &long_idx); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_samples_hdf5.c:118:4: [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(d, s, sizeof(struct latency_sample)); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:308:26: [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 = TEMP_FAILURE_RETRY(open(path, O_RDONLY)); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:355:7: [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). fd = fopen(fn, mode); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:365:2: [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[BUFSIZ]; data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:369:8: [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). fds = fopen(src, "r"); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:106:26: [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 = TEMP_FAILURE_RETRY(open("/dev/cpu_dma_latency", data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:130:32: [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). trace_fd = TEMP_FAILURE_RETRY(open(tracing_on, O_WRONLY)); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:134:36: [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). tracemark_fd = TEMP_FAILURE_RETRY(open(trace_marker, O_WRONLY)); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:141:2: [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]; data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:289:2: [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(sa, res->ai_addr, res->ai_addrlen); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.h:19:25: [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. union { typeof(x) __v; char __t[1]; } __u = { .__t = { 0 } }; \ data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.h:26:25: [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. union { typeof(x) __v; char __t[1]; } __u = { .__v = (v) } ; \ data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:28:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). uint32_t read; data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:33:52: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static int ringbuffer_full(uint32_t size, uint32_t read, uint32_t write) data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:38:38: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static int ringbuffer_empty(uint32_t read, uint32_t write) data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:40:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return write == read; data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:74:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). uint32_t read, idx; data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:76:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read = READ_ONCE(rb->read); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:77:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (ringbuffer_full(rb->size, read, rb->write)) { data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:95:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (ringbuffer_empty(rb->read, write)) data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:102:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). WRITE_ONCE(rb->read, rb->read + 1); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:159:8: [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 (!(strlen(end) == 0 || strlen(end) == 1)) data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:159:28: [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 (!(strlen(end) == 0 || strlen(end) == 1)) data/jitterdebugger-0.3.1+git20200117.b90ff3a/jd_utils.c:320:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, *buf, len - 1); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:229:3: [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(100 * 1000); /* 100 ms interval */ data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:253:3: [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(DEFAULT_INTERVAL); data/jitterdebugger-0.3.1+git20200117.b90ff3a/jitterdebugger.c:316:3: [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(DEFAULT_INTERVAL); ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 1991 in approximately 0.10 seconds (20458 lines/second) Physical Source Lines of Code (SLOC) = 1581 Hits@level = [0] 97 [1] 15 [2] 12 [3] 2 [4] 8 [5] 0 Hits@level+ = [0+] 134 [1+] 37 [2+] 22 [3+] 10 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 84.7565 [1+] 23.4029 [2+] 13.9152 [3+] 6.32511 [4+] 5.06009 [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.