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/nbtscan-1.6/src/errors.h Examining data/nbtscan-1.6/src/list.c Examining data/nbtscan-1.6/src/list.h Examining data/nbtscan-1.6/src/nbtscan.c Examining data/nbtscan-1.6/src/range.c Examining data/nbtscan-1.6/src/range.h Examining data/nbtscan-1.6/src/statusq.c Examining data/nbtscan-1.6/src/statusq.h Examining data/nbtscan-1.6/src/time.h FINAL RESULTS: data/nbtscan-1.6/src/range.c:68:3: [4] (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). strcpy(ip, string); data/nbtscan-1.6/src/range.c:118:2: [4] (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). strcpy(ip,string); data/nbtscan-1.6/src/nbtscan.c:347:16: [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 ((ch = getopt(argc, argv, "vrdelqhm:s:t:b:f:")) != -1) data/nbtscan-1.6/src/nbtscan.c:117:3: [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 name[16]; data/nbtscan-1.6/src/nbtscan.c:180:3: [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 name[16]; data/nbtscan-1.6/src/nbtscan.c:231:3: [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 comp_name[16], user_name[16]; data/nbtscan-1.6/src/nbtscan.c:284:3: [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 comp_name[16]; data/nbtscan-1.6/src/nbtscan.c:336:3: [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 errmsg[80]; data/nbtscan-1.6/src/nbtscan.c:337:3: [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 str[80]; data/nbtscan-1.6/src/nbtscan.c:353:15: [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). timeout=atoi(optarg); data/nbtscan-1.6/src/nbtscan.c:379:17: [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). bandwidth=atoi(optarg); data/nbtscan-1.6/src/nbtscan.c:389:19: [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). retransmits=atoi(optarg); data/nbtscan-1.6/src/nbtscan.c:454:18: [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). targetlist=fopen(filename,"r"); data/nbtscan-1.6/src/range.c:66: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). mask=atoi(separator); data/nbtscan-1.6/src/range.c:123:16: [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). last_octet = atoi(separator); data/nbtscan-1.6/src/statusq.c:45: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[20]; data/nbtscan-1.6/src/statusq.c:56:9: [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. (void)sprintf( buf, "%-15.15s%c", In, name_type ); data/nbtscan-1.6/src/statusq.c:99: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 errmsg[80]; data/nbtscan-1.6/src/statusq.c:130:3: [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 bytes[4]; data/nbtscan-1.6/src/statusq.c:134: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(x.bytes, data, 4); data/nbtscan-1.6/src/statusq.c:140:17: [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 bytes[2]; data/nbtscan-1.6/src/statusq.c:144: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(x.bytes, data, 2); data/nbtscan-1.6/src/statusq.c:224: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(hostinfo->names, buff + offset, name_table_size); data/nbtscan-1.6/src/statusq.h:26: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 ascii_name [16] ; data/nbtscan-1.6/src/statusq.h:37: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 question_name[34]; data/nbtscan-1.6/src/statusq.h:53: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 question_name[34]; data/nbtscan-1.6/src/statusq.h:100: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 nb_name[16]; data/nbtscan-1.6/src/nbtscan.c:141:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, hostinfo->names[i].ascii_name, 15); data/nbtscan-1.6/src/nbtscan.c:193:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, hostinfo->names[i].ascii_name, 15); data/nbtscan-1.6/src/nbtscan.c:236:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(comp_name,"<unknown>",15); data/nbtscan-1.6/src/nbtscan.c:237:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(user_name,"<unknown>",15); data/nbtscan-1.6/src/nbtscan.c:244:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(comp_name, hostinfo->names[i].ascii_name, 15); data/nbtscan-1.6/src/nbtscan.c:252:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(user_name, hostinfo->names[i].ascii_name, 15); data/nbtscan-1.6/src/nbtscan.c:288:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(comp_name,"<unknown>",15); data/nbtscan-1.6/src/nbtscan.c:296:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(comp_name, hostinfo->names[i].ascii_name, 15); data/nbtscan-1.6/src/range.c:60:26: [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((ip = (char *)malloc(strlen(string)+1))==NULL) data/nbtscan-1.6/src/range.c:63:6: [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(string)>19) return 0; data/nbtscan-1.6/src/range.c:116:26: [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((ip = (char *)malloc(strlen(string)+1))==NULL) data/nbtscan-1.6/src/statusq.c:78:19: [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). return( strlen(Out) ); data/nbtscan-1.6/src/statusq.c:89:17: [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). return( strlen(Out) ); data/nbtscan-1.6/src/statusq.c:195:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(response_header->question_name, buff+offset, sizeof(response_header->question_name)); ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 1605 in approximately 0.07 seconds (23665 lines/second) Physical Source Lines of Code (SLOC) = 1278 Hits@level = [0] 141 [1] 14 [2] 24 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 182 [1+] 41 [2+] 27 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 142.41 [1+] 32.0814 [2+] 21.1268 [3+] 2.34742 [4+] 1.56495 [5+] 0 Dot directories skipped = 2 (--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.