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/netsed-1.2/netsed.c FINAL RESULTS: data/netsed-1.2/netsed.c:134:19: [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 ERR(x...) fprintf(stderr,x) data/netsed-1.2/netsed.c:140:19: [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. #define DBG(x...) printf(x) data/netsed-1.2/netsed.c:473:15: [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 ((i = getopt_long(argc, argv, "46h", long_options, NULL)) != -1) data/netsed-1.2/netsed.c:475:15: [3] (buffer) getopt: 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 ((i = getopt(argc, argv, "46h")) != -1) data/netsed-1.2/netsed.c:533:24: [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). rule_live[rules]=atoi(cs); else rule_live[rules]=-1; data/netsed-1.2/netsed.c:597:1: [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[MAX_BUF]; data/netsed-1.2/netsed.c:599:1: [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 b2[MAX_BUF]; data/netsed-1.2/netsed.c:621: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(&b2[newsize],rule[j].to,rule[j].ts); data/netsed-1.2/netsed.c:746:7: [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(&fixedhost, res->ai_addr, res->ai_addrlen); data/netsed-1.2/netsed.c:779: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 ipstr[INET6_ADDRSTRLEN], portstr[12]; data/netsed-1.2/netsed.c:881:11: [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(conn->csa, &s, l); data/netsed-1.2/netsed.c:890: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(conn->live, rule_live, rules*sizeof(int)); data/netsed-1.2/netsed.c:394:18: [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). r->from=malloc(strlen(r->forig)); data/netsed-1.2/netsed.c:395: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). r->to=malloc(strlen(r->torig)); data/netsed-1.2/netsed.c:398:14: [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). for (i=0;i<strlen(r->forig);i++) { data/netsed-1.2/netsed.c:427:14: [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). for (i=0;i<strlen(r->torig);i++) { data/netsed-1.2/netsed.c:649:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rd=read(conn->fsock,buf,sizeof(buf)); data/netsed-1.2/netsed.c:676:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rd=read(conn->csock,buf,sizeof(buf)); ANALYSIS SUMMARY: Hits = 18 Lines analyzed = 970 in approximately 0.04 seconds (26715 lines/second) Physical Source Lines of Code (SLOC) = 640 Hits@level = [0] 20 [1] 6 [2] 8 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 38 [1+] 18 [2+] 12 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 59.375 [1+] 28.125 [2+] 18.75 [3+] 6.25 [4+] 3.125 [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.