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/lltdscan-0+20180223/lltd.c Examining data/lltdscan-0+20180223/lltdscan.c FINAL RESULTS: data/lltdscan-0+20180223/lltdscan.c:134:21: [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 ((c = getopt(argc, argv, "t:i:hvu")) != EOF) { data/lltdscan-0+20180223/lltd.c:11: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[0x40]; data/lltdscan-0+20180223/lltd.c:12: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 comment[0x100]; data/lltdscan-0+20180223/lltd.c:18:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x80) strcat(comment, "NAT-public, "); data/lltdscan-0+20180223/lltd.c:19:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x40) strcat(comment, "NAT-private, "); data/lltdscan-0+20180223/lltd.c:20:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x20) strcat(comment, "full-duplex, "); data/lltdscan-0+20180223/lltd.c:21:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x10) strcat(comment, "has_HTTP, "); data/lltdscan-0+20180223/lltd.c:22:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x08) strcat(comment, "loopback, "); data/lltdscan-0+20180223/lltd.c:28:19: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. if(p[5] == 6) strcpy(comment,"Ethernet"); data/lltdscan-0+20180223/lltd.c:29:19: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. if(p[5] == 71) strcpy(comment,"802.11"); data/lltdscan-0+20180223/lltd.c:37:5: [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(buf, "%d Mbit/s", spd/10000); data/lltdscan-0+20180223/lltd.c:39:5: [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(buf, "%d kbit/s", spd/10); data/lltdscan-0+20180223/lltd.c:44:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x80) strcat(comment, "qWave-enabled, "); data/lltdscan-0+20180223/lltd.c:45:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x40) strcat(comment, "802.1q-support, "); data/lltdscan-0+20180223/lltd.c:46:18: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if(p[2]&0x20) strcat(comment, "802.1p-support, "); data/lltdscan-0+20180223/lltd.c:52:12: [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. if(!desc) sprintf(desc=buf, "0x%02x", *p); data/lltdscan-0+20180223/lltd.c:143:4: [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(buf, "%d.%d.%d.%d", p[2], p[3], p[4], p[5]); data/lltdscan-0+20180223/lltdscan.c:59: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 mac[0x20]; data/lltdscan-0+20180223/lltdscan.c:63: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(&host_id, packet+48, 6); data/lltdscan-0+20180223/lltdscan.c:70: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(mac, "%02x:%02x:%02x:%02x:%02x:%02x", data/lltdscan-0+20180223/lltdscan.c:118: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 errbuf [ERRBUF_SIZE]; /* Error string */ data/lltdscan-0+20180223/lltdscan.c:140:8: [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). i = atoi(optarg); data/lltdscan-0+20180223/lltdscan.c:209: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(buf,payload,18); data/lltdscan-0+20180223/lltdscan.c:210: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(buf+10, ha, 6); data/lltdscan-0+20180223/lltdscan.c:213: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(buf+16, &start_time.tv_sec, 2); // emulate sequence number data/lltdscan-0+20180223/lltd.c:24:13: [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). comment[strlen(comment)-2] = 0; data/lltdscan-0+20180223/lltd.c:48:13: [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). comment[strlen(comment)-2] = 0; data/lltdscan-0+20180223/lltdscan.c:169: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(argv[0]) != 17 ){ data/lltdscan-0+20180223/lltdscan.c:275: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(1000); ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 451 in approximately 0.02 seconds (19890 lines/second) Physical Source Lines of Code (SLOC) = 382 Hits@level = [0] 23 [1] 4 [2] 24 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 52 [1+] 29 [2+] 25 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 136.126 [1+] 75.9162 [2+] 65.445 [3+] 2.6178 [4+] 0 [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.