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/netstress-1.2.0/netstress.c FINAL RESULTS: data/netstress-1.2.0/netstress.c:264:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, ap); data/netstress-1.2.0/netstress.c:283:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, ap); data/netstress-1.2.0/netstress.c:297:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(child->identity, "%d=%s", data/netstress-1.2.0/netstress.c:480: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, short_options, long_options, &optind); data/netstress-1.2.0/netstress.c:920:3: [3] (random) srandom: 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. srandom((unsigned int)seed); data/netstress-1.2.0/netstress.c:922:17: [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. lbuffer[i] = random(); data/netstress-1.2.0/netstress.c:1520:5: [3] (random) srandom: 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. srandom((unsigned int)seed); data/netstress-1.2.0/netstress.c:1522:31: [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. uint32_t random_number = random(); data/netstress-1.2.0/netstress.c:1721:15: [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. next_seed = random(); data/netstress-1.2.0/netstress.c:1722:18: [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. nBytes2Write = random()%(uint32_t)(MAX_PACKET_SIZE-HEADER_SIZE); data/netstress-1.2.0/netstress.c:1735:4: [3] (random) srandom: 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. srandom((unsigned int)seed); data/netstress-1.2.0/netstress.c:1737:30: [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. uint32_t random_number = random(); data/netstress-1.2.0/netstress.c:108: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 connectionName[MAX_CONNECTIONNAME]; data/netstress-1.2.0/netstress.c:109: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 identity[MAX_IDENTITY]; data/netstress-1.2.0/netstress.c:129: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 s_measure[64]; /* Benchmark divider in string format */ data/netstress-1.2.0/netstress.c:143: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 connectionName[MAX_CONNECTIONNAME]; data/netstress-1.2.0/netstress.c:152:11: [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. unsigned char randomTxBuffer[(MAX_PACKET_SIZE+sizeof(long)) * 2]; data/netstress-1.2.0/netstress.c:153:11: [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. unsigned char randomRxBuffer[(MAX_PACKET_SIZE+sizeof(long)) * 2]; data/netstress-1.2.0/netstress.c:295:3: [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(child->identity, "%d", child->connectionID); data/netstress-1.2.0/netstress.c:510:20: [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). context->port = atoi(optarg); data/netstress-1.2.0/netstress.c:513:20: [2] (integer) atol: 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). context->seed = atol(optarg); data/netstress-1.2.0/netstress.c:519:38: [2] (integer) atol: 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). context->report_every_n_seconds = atol(optarg); data/netstress-1.2.0/netstress.c:522:41: [2] (integer) atol: 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). context->benchmark_every_n_reports = atol(optarg); data/netstress-1.2.0/netstress.c:1171: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((char *)&context->that_sockaddr.sin_addr.s_addr, data/netstress-1.2.0/netstress.c:1288: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. static char time_buffer[64]; data/netstress-1.2.0/netstress.c:1308:2: [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(time_buffer, "%ldd %02ldh %02ldm %02lds", data/netstress-1.2.0/netstress.c:1320: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. static char time_buffer[64]; data/netstress-1.2.0/netstress.c:1341: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. static char speed_buffer[64]; data/netstress-1.2.0/netstress.c:1401:11: [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. unsigned char buffer[MAX_PACKET_SIZE+sizeof(long)]; data/netstress-1.2.0/netstress.c:1635:11: [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. unsigned char buffer[MAX_PACKET_SIZE+sizeof(long)+HEADER_SIZE]; data/netstress-1.2.0/netstress.c:1741: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(&(lbuffer[LHEADER_SIZE]), &(lrbuffer[offset]), (size_t)nBytes2Write); data/netstress-1.2.0/netstress.c:492:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(context->connectionName, optarg, data/netstress-1.2.0/netstress.c:502:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(context->children[0].connectionName, optarg, data/netstress-1.2.0/netstress.c:958:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void) read(socket_fd, child->connectionName, data/netstress-1.2.0/netstress.c:961:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void) read(socket_fd, &checksum, sizeof(checksum)); data/netstress-1.2.0/netstress.c:976:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void) read(socket_fd, &child->connectionID, data/netstress-1.2.0/netstress.c:979:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void) read(socket_fd, context->connectionName, data/netstress-1.2.0/netstress.c:982:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void) read(socket_fd, &checksum, sizeof(checksum)); data/netstress-1.2.0/netstress.c:1324:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(time_buffer, ctime(¤t_time), sizeof(time_buffer)); data/netstress-1.2.0/netstress.c:1367:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nBytesRead = read(socket_fd, cp, (int)nBytes2Read); ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 1817 in approximately 0.07 seconds (25667 lines/second) Physical Source Lines of Code (SLOC) = 1256 Hits@level = [0] 105 [1] 9 [2] 19 [3] 9 [4] 3 [5] 0 Hits@level+ = [0+] 145 [1+] 40 [2+] 31 [3+] 12 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 115.446 [1+] 31.8471 [2+] 24.6815 [3+] 9.55414 [4+] 2.38854 [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.