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/wrk-4.1.0/src/ae.c Examining data/wrk-4.1.0/src/ae.h Examining data/wrk-4.1.0/src/ae_epoll.c Examining data/wrk-4.1.0/src/ae_evport.c Examining data/wrk-4.1.0/src/ae_kqueue.c Examining data/wrk-4.1.0/src/ae_select.c Examining data/wrk-4.1.0/src/aprintf.c Examining data/wrk-4.1.0/src/aprintf.h Examining data/wrk-4.1.0/src/atomicvar.h Examining data/wrk-4.1.0/src/config.h Examining data/wrk-4.1.0/src/http_parser.c Examining data/wrk-4.1.0/src/http_parser.h Examining data/wrk-4.1.0/src/main.h Examining data/wrk-4.1.0/src/net.c Examining data/wrk-4.1.0/src/net.h Examining data/wrk-4.1.0/src/script.h Examining data/wrk-4.1.0/src/ssl.c Examining data/wrk-4.1.0/src/ssl.h Examining data/wrk-4.1.0/src/stats.h Examining data/wrk-4.1.0/src/units.c Examining data/wrk-4.1.0/src/units.h Examining data/wrk-4.1.0/src/wrk.c Examining data/wrk-4.1.0/src/wrk.h Examining data/wrk-4.1.0/src/zmalloc.c Examining data/wrk-4.1.0/src/zmalloc.h Examining data/wrk-4.1.0/src/script.c Examining data/wrk-4.1.0/src/stats.c FINAL RESULTS: data/wrk-4.1.0/src/aprintf.c:14:9: [4] (format) vsnprintf: 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. n = vsnprintf(NULL, 0, fmt, ap) + 1; data/wrk-4.1.0/src/aprintf.c:22:9: [4] (format) vsnprintf: 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. vsnprintf(c, n, fmt, ap); data/wrk-4.1.0/src/wrk.c:492:17: [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. while ((c = getopt_long(argc, argv, "t:c:d:s:H:T:Lrv?", longopts, NULL)) != -1) { data/wrk-4.1.0/src/ae_select.c:81:5: [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(&state->_rfds,&state->rfds,sizeof(fd_set)); data/wrk-4.1.0/src/ae_select.c:82:5: [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(&state->_wfds,&state->wfds,sizeof(fd_set)); data/wrk-4.1.0/src/http_parser.c:186:14: [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 const char tokens[256] = { data/wrk-4.1.0/src/script.c:167:5: [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(*buf, str, *len); data/wrk-4.1.0/src/script.c:316:5: [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(dst->ai_addr, src->ai_addr, src->ai_addrlen); data/wrk-4.1.0/src/script.c:329: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 host[NI_MAXHOST]; data/wrk-4.1.0/src/script.c:330: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 service[NI_MAXSERV]; data/wrk-4.1.0/src/script.c:568:5: [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(b->cursor, data, len); data/wrk-4.1.0/src/units.c:60: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 unit[3] = { 0, 0, 0 }; data/wrk-4.1.0/src/wrk.c:463: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(part, &url[off], len); data/wrk-4.1.0/src/wrk.h:63: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[RECVBUF]; data/wrk-4.1.0/src/zmalloc.c:208:5: [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(p,s,l); data/wrk-4.1.0/src/zmalloc.c:241: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[4096]; data/wrk-4.1.0/src/zmalloc.c:242: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 filename[256]; data/wrk-4.1.0/src/zmalloc.c:247: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). if ((fd = open(filename,O_RDONLY)) == -1) return 0; data/wrk-4.1.0/src/zmalloc.c:317: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 line[1024]; data/wrk-4.1.0/src/zmalloc.c:323:14: [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). fp = fopen("/proc/self/smaps","r"); data/wrk-4.1.0/src/zmalloc.c:325:9: [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 filename[128]; data/wrk-4.1.0/src/zmalloc.c:327:14: [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). fp = fopen(filename,"r"); data/wrk-4.1.0/src/aprintf.c:17:16: [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). len = *s ? strlen(*s) : 0; data/wrk-4.1.0/src/net.c:18:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t r = read(c->fd, c->buf, sizeof(c->buf)); data/wrk-4.1.0/src/net.h:18:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). status ( *read)(connection *, size_t *); data/wrk-4.1.0/src/script.c:230:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). errors->read, data/wrk-4.1.0/src/script.c:512:37: [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 (!http_parser_parse_url(url, strlen(url), 0, parts)) { data/wrk-4.1.0/src/stats.h:12:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). uint32_t read; data/wrk-4.1.0/src/units.c:63:14: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if ((c = sscanf(s, "%"SCNu64"%2s", &base, unit)) < 1) return -1; data/wrk-4.1.0/src/wrk.c:157:37: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). errors.read += t->errors.read; data/wrk-4.1.0/src/wrk.c:181:34: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (errors.connect || errors.read || errors.write || errors.timeout) { data/wrk-4.1.0/src/wrk.c:183:39: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). errors.connect, errors.read, errors.write, errors.timeout); data/wrk-4.1.0/src/wrk.c:431:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch (sock.read(c, &n)) { data/wrk-4.1.0/src/wrk.c:552: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). int len = strlen(msg), pad = 2; data/wrk-4.1.0/src/zmalloc.c:205:16: [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). size_t l = strlen(s)+1; data/wrk-4.1.0/src/zmalloc.c:248:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd,buf,4096) <= 0) { data/wrk-4.1.0/src/zmalloc.c:319:16: [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). int flen = strlen(field); ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 6571 in approximately 0.18 seconds (37453 lines/second) Physical Source Lines of Code (SLOC) = 4737 Hits@level = [0] 38 [1] 15 [2] 19 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 75 [1+] 37 [2+] 22 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 15.8328 [1+] 7.81085 [2+] 4.64429 [3+] 0.633312 [4+] 0.422208 [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.