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/redir-3.3/redir.c FINAL RESULTS: data/redir-3.3/redir.c:671:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf((char *)&buf, "CONNECT %s HTTP/1.0\n\n", connect_str); data/redir-3.3/redir.c:295:16: [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 ((opt = getopt_long(argc, argv, "b:hiI:l:npst:vx:" FTP_OPTS SHAPER_OPTS, long_options, NULL)) != -1) { data/redir-3.3/redir.c:874:3: [3] (random) srand: 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. srand(getpid()); data/redir-3.3/redir.c:196:9: [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). return atoi(level); data/redir-3.3/redir.c:208: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). port = atoi(arg); data/redir-3.3/redir.c:281: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 src[INET6_ADDRSTRLEN] = "", dst[INET6_ADDRSTRLEN] = ""; data/redir-3.3/redir.c:341:14: [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). timeout = atol(optarg); data/redir-3.3/redir.c:346: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). max_bandwidth = atol(optarg); data/redir-3.3/redir.c:350:18: [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). wait_in_out = atol(optarg); data/redir-3.3/redir.c:356:18: [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). random_wait = atol(optarg); data/redir-3.3/redir.c:360:28: [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). bufsize = (unsigned int)atol(optarg); data/redir-3.3/redir.c:517:14: [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. (*bytes) = sprintf(buf, "PORT %d,%d,%d,%d,%d,%d\n", data/redir-3.3/redir.c:524:14: [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. (*bytes) = sprintf(buf, "227 Entering Passive Mode (%d,%d,%d,%d,%d,%d)\n", data/redir-3.3/redir.c:668: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/redir-3.3/redir.c:724:3: [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(&target->sin_addr, hp->h_addr, hp->h_length); data/redir-3.3/redir.c:756:3: [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(&addr_out, &peer, sizeof(struct sockaddr_in)); data/redir-3.3/redir.c:772:3: [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(&addr_out.sin_addr, hp->h_addr, hp->h_length); data/redir-3.3/redir.c:930:3: [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(&server.sin_addr, hp->h_addr, hp->h_length); data/redir-3.3/redir.c:412:7: [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(dst) > 1) data/redir-3.3/redir.c:419:7: [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(src) > 1) data/redir-3.3/redir.c:423:7: [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(dst) > 1) data/redir-3.3/redir.c:614:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes = read(insock, buf, bufsize); data/redir-3.3/redir.c:635:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes = read(outsock, buf, bufsize); data/redir-3.3/redir.c:672:34: [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). x = write(socket, (char *)&buf, strlen(buf)); data/redir-3.3/redir.c:679:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). x = read(socket, (char *)&buf, sizeof(buf)); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 1043 in approximately 0.05 seconds (22960 lines/second) Physical Source Lines of Code (SLOC) = 773 Hits@level = [0] 53 [1] 7 [2] 15 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 78 [1+] 25 [2+] 18 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 100.906 [1+] 32.3415 [2+] 23.2859 [3+] 3.88098 [4+] 1.29366 [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.