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/libnitrokey-3.5/DeviceCommunicationExceptions.cpp Examining data/libnitrokey-3.5/NK_C_API.cc Examining data/libnitrokey-3.5/NK_C_API.h Examining data/libnitrokey-3.5/NitrokeyManager.cc Examining data/libnitrokey-3.5/command_id.cc Examining data/libnitrokey-3.5/device.cc Examining data/libnitrokey-3.5/libnitrokey/CommandFailedException.h Examining data/libnitrokey-3.5/libnitrokey/DeviceCommunicationExceptions.h Examining data/libnitrokey-3.5/libnitrokey/LibraryException.h Examining data/libnitrokey-3.5/libnitrokey/LongOperationInProgressException.h Examining data/libnitrokey-3.5/libnitrokey/NitrokeyManager.h Examining data/libnitrokey-3.5/libnitrokey/command.h Examining data/libnitrokey-3.5/libnitrokey/command_id.h Examining data/libnitrokey-3.5/libnitrokey/cxx_semantics.h Examining data/libnitrokey-3.5/libnitrokey/deprecated.h Examining data/libnitrokey-3.5/libnitrokey/device.h Examining data/libnitrokey-3.5/libnitrokey/device_proto.h Examining data/libnitrokey-3.5/libnitrokey/dissect.h Examining data/libnitrokey-3.5/libnitrokey/hidapi/hidapi.h Examining data/libnitrokey-3.5/libnitrokey/log.h Examining data/libnitrokey-3.5/libnitrokey/misc.h Examining data/libnitrokey-3.5/libnitrokey/stick10_commands.h Examining data/libnitrokey-3.5/libnitrokey/stick10_commands_0.8.h Examining data/libnitrokey-3.5/libnitrokey/stick20_commands.h Examining data/libnitrokey-3.5/libnitrokey/version.h Examining data/libnitrokey-3.5/log.cc Examining data/libnitrokey-3.5/misc.cc Examining data/libnitrokey-3.5/unittest/catch_main.cpp Examining data/libnitrokey-3.5/unittest/test1.cc Examining data/libnitrokey-3.5/unittest/test2.cc Examining data/libnitrokey-3.5/unittest/test3.cc Examining data/libnitrokey-3.5/unittest/test_C_API.cpp Examining data/libnitrokey-3.5/unittest/test_HOTP.cc Examining data/libnitrokey-3.5/unittest/test_command_ids_header.h Examining data/libnitrokey-3.5/unittest/test_issues.cc Examining data/libnitrokey-3.5/unittest/test_minimal.c Examining data/libnitrokey-3.5/unittest/test_multiple_devices.cc Examining data/libnitrokey-3.5/unittest/test_offline.cc Examining data/libnitrokey-3.5/unittest/test_safe.cpp Examining data/libnitrokey-3.5/unittest/test_strdup.cpp Examining data/libnitrokey-3.5/version.cc FINAL RESULTS: data/libnitrokey-3.5/unittest/test3.cc:56: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((char *) (authreq.card_password), default_admin_pin); data/libnitrokey-3.5/unittest/test3.cc:57: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((char *) (authreq.temporary_password), temporary_password); data/libnitrokey-3.5/unittest/test_HOTP.cc:72:7: [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((char *)(authreq.temporary_password), temporary_password); data/libnitrokey-3.5/unittest/test_HOTP.cc:92:9: [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((char *)(auth.temporary_password), temporary_password); data/libnitrokey-3.5/NK_C_API.cc:39: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(dup, str, len); data/libnitrokey-3.5/NitrokeyManager.cc:48: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(dup, str, len); data/libnitrokey-3.5/device.cc:257:12: [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 buf[1]; data/libnitrokey-3.5/misc.cc:46: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 buf[3]; data/libnitrokey-3.5/misc.cc:67: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 formatbuf[128]; data/libnitrokey-3.5/unittest/test1.cc:56:3: [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. strcpy((char *)(authreq.card_password), "12345678"); data/libnitrokey-3.5/unittest/test1.cc:61:5: [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. strcpy((char *)(authreq.user_password), "123456"); data/libnitrokey-3.5/unittest/test_HOTP.cc:39: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 buf[3]; data/libnitrokey-3.5/unittest/test_HOTP.cc:71:7: [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. strcpy((char *)(authreq.card_password), "12345678"); data/libnitrokey-3.5/unittest/test_HOTP.cc:80:5: [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. strcpy(reinterpret_cast<char *>(hwrite.slot_name), "rfc4226_lib"); data/libnitrokey-3.5/NitrokeyManager.cc:429:50: [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(user_temporary_password != nullptr && strlen(user_temporary_password)!=0){ //FIXME use string instead of strlen data/libnitrokey-3.5/NitrokeyManager.cc:437:50: [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(user_temporary_password != nullptr && strlen(user_temporary_password)!=0) { data/libnitrokey-3.5/NitrokeyManager.cc:467:52: [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(user_temporary_password != nullptr && strlen(user_temporary_password)!=0){ //FIXME use string instead of strlen data/libnitrokey-3.5/libnitrokey/misc.h:94:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char*) &dest, src, s_dest); data/libnitrokey-3.5/unittest/test_HOTP.cc:38:11: [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). REQUIRE(strlen(hexString)%2==0); data/libnitrokey-3.5/unittest/test_HOTP.cc:41:23: [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(size_t i=0; i<strlen(hexString); i++){ ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 9721 in approximately 0.28 seconds (34118 lines/second) Physical Source Lines of Code (SLOC) = 6233 Hits@level = [0] 5 [1] 6 [2] 10 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 25 [1+] 20 [2+] 14 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 4.01091 [1+] 3.20873 [2+] 2.24611 [3+] 0.641746 [4+] 0.641746 [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.