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/yubikey-personalization-1.20.0/ykpers_lcl.c Examining data/yubikey-personalization-1.20.0/ykcore/ykcore.h Examining data/yubikey-personalization-1.20.0/ykcore/ykcore_windows.c Examining data/yubikey-personalization-1.20.0/ykcore/ykdef.h Examining data/yubikey-personalization-1.20.0/ykcore/ykcore_libusb-1.0.c Examining data/yubikey-personalization-1.20.0/ykcore/ykcore_backend.h Examining data/yubikey-personalization-1.20.0/ykcore/ykcore_stub.c Examining data/yubikey-personalization-1.20.0/ykcore/ykstatus.h Examining data/yubikey-personalization-1.20.0/ykcore/ykcore_libusb.c Examining data/yubikey-personalization-1.20.0/ykcore/yktsd.h Examining data/yubikey-personalization-1.20.0/ykcore/ykbzero.h Examining data/yubikey-personalization-1.20.0/ykcore/ykcore_lcl.h Examining data/yubikey-personalization-1.20.0/ykcore/ykcore_osx.c Examining data/yubikey-personalization-1.20.0/ykcore/ykcore.c Examining data/yubikey-personalization-1.20.0/ykcore/ykstatus.c Examining data/yubikey-personalization-1.20.0/ykpbkdf2.c Examining data/yubikey-personalization-1.20.0/sha224-256.c Examining data/yubikey-personalization-1.20.0/ykpers.h Examining data/yubikey-personalization-1.20.0/ykchalresp.c Examining data/yubikey-personalization-1.20.0/ykpers-json.h Examining data/yubikey-personalization-1.20.0/ykpbkdf2.h Examining data/yubikey-personalization-1.20.0/ykpers-args.c Examining data/yubikey-personalization-1.20.0/ykpers-nojson.c Examining data/yubikey-personalization-1.20.0/usha.c Examining data/yubikey-personalization-1.20.0/ykpers.c Examining data/yubikey-personalization-1.20.0/ykpers-version.c Examining data/yubikey-personalization-1.20.0/tests/test_key_generation.c Examining data/yubikey-personalization-1.20.0/tests/test_threaded_calls.c Examining data/yubikey-personalization-1.20.0/tests/test_ykpbkdf2.c Examining data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c Examining data/yubikey-personalization-1.20.0/tests/selftest.c Examining data/yubikey-personalization-1.20.0/tests/test_yk_utilities.c Examining data/yubikey-personalization-1.20.0/tests/test_args_to_config.c Examining data/yubikey-personalization-1.20.0/tests/test_json.c Examining data/yubikey-personalization-1.20.0/sha384-512.c Examining data/yubikey-personalization-1.20.0/sha-private.h Examining data/yubikey-personalization-1.20.0/sha.h Examining data/yubikey-personalization-1.20.0/sha1.c Examining data/yubikey-personalization-1.20.0/ykpers_lcl.h Examining data/yubikey-personalization-1.20.0/ykinfo.c Examining data/yubikey-personalization-1.20.0/ykpers-version.h Examining data/yubikey-personalization-1.20.0/hmac.c Examining data/yubikey-personalization-1.20.0/ykpersonalize.c Examining data/yubikey-personalization-1.20.0/ykpers-args.h Examining data/yubikey-personalization-1.20.0/ykpers-json.c FINAL RESULTS: data/yubikey-personalization-1.20.0/ykchalresp.c:95:13: [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, optstring)) != -1) { data/yubikey-personalization-1.20.0/ykinfo.c:92:13: [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, optstring)) != -1) { data/yubikey-personalization-1.20.0/ykpers-args.c:278:13: [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, optstring)) != -1) { data/yubikey-personalization-1.20.0/ykpersonalize.c:84:13: [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, optstring)) != -1) { data/yubikey-personalization-1.20.0/hmac.c:38:46: [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. int hmac(SHAversion whichSha, const unsigned char *text, int text_len, data/yubikey-personalization-1.20.0/hmac.c:39:20: [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. const unsigned char *key, int key_len, data/yubikey-personalization-1.20.0/hmac.c:75: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 k_ipad[USHA_Max_Message_Block_Size]; data/yubikey-personalization-1.20.0/hmac.c:78: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 tempkey[USHAMaxHashSize]; data/yubikey-personalization-1.20.0/sha.h:169:14: [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 k_opad[USHA_Max_Message_Block_Size]; data/yubikey-personalization-1.20.0/tests/test_args_to_config.c:117: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 oathid[128] = {0}; data/yubikey-personalization-1.20.0/tests/test_args_to_config.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 ndef[128]; data/yubikey-personalization-1.20.0/tests/test_args_to_config.c:126:11: [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 scan_map[sizeof(SCAN_MAP)]; data/yubikey-personalization-1.20.0/tests/test_args_to_config.c:127:11: [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 device_info[128]; data/yubikey-personalization-1.20.0/tests/test_args_to_config.c:310: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 oathid[128] = {0}; data/yubikey-personalization-1.20.0/tests/test_args_to_config.c:311: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 ndef[128]; data/yubikey-personalization-1.20.0/tests/test_args_to_config.c:319:11: [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 scan_map[sizeof(SCAN_MAP)]; data/yubikey-personalization-1.20.0/tests/test_args_to_config.c:320:11: [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 device_info[128]; data/yubikey-personalization-1.20.0/tests/test_json.c:55: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 out[1024] = {0}; data/yubikey-personalization-1.20.0/tests/test_json.c:66: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 data[1024] = "{ \"yubiProdConfig\": { \"mode\": \"oathHOTP\", \"options\": { \"fixedModhex\": false, \"oathDigits\": 6, \"fixedSeedvalue\": 0, \"randomSeed\": false, \"tabFirst\": false, \"tabBetween\": false, \"tabLast\": false, \"appendDelay1\": false, \"appendDelay2\": false, \"appendCR\": true, \"protectSecond\": false, \"sendRef\": false, \"ticketFirst\": false, \"pacing10MS\": false, \"pacing20MS\": false, \"allowHidtrig\": false, \"serialBtnVisible\": true, \"serialUsbVisible\": false, \"serialApiVisible\": true, \"useNumericKeypad\": false, \"fastTrig\": false, \"allowUpdate\": false, \"dormant\": false, \"ledInverted\": false } } }"; data/yubikey-personalization-1.20.0/tests/test_key_generation.c:40:11: [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 empty[256]; data/yubikey-personalization-1.20.0/tests/test_key_generation.c:56:11: [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 empty[256]; data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:44: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 text[256]; data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:72: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 text[256]; data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:89: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 text2[256]; data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:108: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 text2[256]; data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:126: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 text[256]; data/yubikey-personalization-1.20.0/tests/test_ykpbkdf2.c:68:11: [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[64]; data/yubikey-personalization-1.20.0/tests/test_ykpbkdf2.c:102:11: [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[64]; data/yubikey-personalization-1.20.0/tests/test_ykpbkdf2.c:136:11: [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[64]; data/yubikey-personalization-1.20.0/tests/test_ykpbkdf2.c:170:11: [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[64]; data/yubikey-personalization-1.20.0/tests/test_ykpbkdf2.c:206:11: [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[64]; data/yubikey-personalization-1.20.0/tests/test_ykpbkdf2.c:238:11: [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[64]; data/yubikey-personalization-1.20.0/ykchalresp.c:131:13: [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). input = fopen(optarg, "r"); data/yubikey-personalization-1.20.0/ykchalresp.c:137: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). *key_index = atoi(optarg); data/yubikey-personalization-1.20.0/ykchalresp.c:158:19: [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. static unsigned char t_buf[8]; data/yubikey-personalization-1.20.0/ykchalresp.c:170:19: [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. static unsigned char buf[65] = {0}; data/yubikey-personalization-1.20.0/ykchalresp.c:182:26: [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. *challenge = (unsigned char *) argv[optind]; data/yubikey-personalization-1.20.0/ykchalresp.c:187:19: [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. static unsigned char decoded[SHA1_MAX_BLOCK_SIZE]; data/yubikey-personalization-1.20.0/ykchalresp.c:248:11: [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 response[SHA1_MAX_BLOCK_SIZE]; data/yubikey-personalization-1.20.0/ykchalresp.c:249:11: [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 output_buf[(SHA1_MAX_BLOCK_SIZE * 2) + 1]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:162:11: [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[FEATURE_RPT_SIZE * 2]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:269:11: [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[sizeof(YK_CONFIG) + ACC_CODE_SIZE]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:279: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(buf, cfg, sizeof(YK_CONFIG)); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:285: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(buf + sizeof(YK_CONFIG), acc_code, ACC_CODE_SIZE); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:321:11: [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[sizeof(YK_NDEF)]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:339: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, ndef, sizeof(YK_NDEF)); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:346:11: [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[sizeof(YK_DEVICE_CONFIG)]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:349: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, device_config, sizeof(YK_DEVICE_CONFIG)); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:470:11: [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 data[FEATURE_RPT_SIZE]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:484: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, data + 1, bufsize); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:500:11: [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 data[FEATURE_RPT_SIZE]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:531:4: [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(last_data, data, sizeof(data)); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:592:11: [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 data[FEATURE_RPT_SIZE]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:608: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((char*)buf + *bytes_read, data, sizeof(data) - 1); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:650:4: [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((char*)buf + *bytes_read, data, sizeof(data) - 1); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:675:11: [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 repbuf[FEATURE_RPT_SIZE]; data/yubikey-personalization-1.20.0/ykcore/ykcore.c:688: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(frame.payload, buf, bufcount); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:745:11: [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[FEATURE_RPT_SIZE]; data/yubikey-personalization-1.20.0/ykcore/ykcore_windows.c:160: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 (buffer, buf + 1, buffer_size); data/yubikey-personalization-1.20.0/ykcore/ykcore_windows.c:177: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 + 1, buffer, buffer_size); data/yubikey-personalization-1.20.0/ykcore/ykcore_windows.c:201: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. static char buf[1024]; data/yubikey-personalization-1.20.0/ykcore/ykdef.h:76:14: [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 payload[SLOT_DATA_SIZE]; /* Frame payload */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:79:14: [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 filler[3]; /* Filler */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:87:11: [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 uid[UID_SIZE]; /* Unique (secret) ID */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:109:11: [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 fixed[FIXED_SIZE];/* Fixed data in binary format */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:110:11: [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 uid[UID_SIZE]; /* Fixed UID part of ticket */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:111:11: [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 key[KEY_SIZE]; /* AES key */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:112:11: [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 accCode[ACC_CODE_SIZE]; /* Access code to re-program device */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:117:11: [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 rfu[2]; /* Reserved for future use */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:198:11: [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 data[NDEF_DATA_SIZE]; /* Payload size */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:199:11: [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 curAccCode[ACC_CODE_SIZE]; /* Access code */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:210:11: [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 scancode[MAX_URL];/* Scancode (lower 7 bits) */ data/yubikey-personalization-1.20.0/ykcore/ykdef.h:211:11: [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 scanmod[MAX_URL >> 2]; /* Modifier fields (packed 2 bits each) */ data/yubikey-personalization-1.20.0/ykinfo.c:113: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). *key_index = atoi(optarg); data/yubikey-personalization-1.20.0/ykinfo.c:224:4: [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[64]; data/yubikey-personalization-1.20.0/ykinfo.c:225:4: [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 hex_serial[64]; data/yubikey-personalization-1.20.0/ykinfo.c:226:4: [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 modhex_serial[64]; data/yubikey-personalization-1.20.0/ykinfo.c:302: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[0xff]; data/yubikey-personalization-1.20.0/ykpbkdf2.c:71: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 block[256]; /* A big chunk, that's 2048 bits */ data/yubikey-personalization-1.20.0/ykpbkdf2.c:76: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(block, salt, salt_len); data/yubikey-personalization-1.20.0/ykpers-args.c:551:14: [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 uidbin[256]; data/yubikey-personalization-1.20.0/ykpers-args.c:790: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 keybuf[20]; data/yubikey-personalization-1.20.0/ykpers-args.c:816:25: [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). FILE *random_file = fopen(*random_place, "r"); data/yubikey-personalization-1.20.0/ykpers-args.c:868:11: [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 fixedbin[256]; data/yubikey-personalization-1.20.0/ykpers-json.c:122:4: [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 prefix[5] = {0}; data/yubikey-personalization-1.20.0/ykpers.c:116: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(&cfg->ykcore_config, &default_config1, data/yubikey-personalization-1.20.0/ykpers.c:234: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(&cfg->ykcore_config, &default_config1, data/yubikey-personalization-1.20.0/ykpers.c:238: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(&cfg->ykcore_config, &default_config2, data/yubikey-personalization-1.20.0/ykpers.c:267: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 aesbin[256]; data/yubikey-personalization-1.20.0/ykpers.c:303: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(cfg->ykcore_config.key, key, size); data/yubikey-personalization-1.20.0/ykpers.c:304: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(cfg->ykcore_config.uid, key + size, 20 - size); data/yubikey-personalization-1.20.0/ykpers.c:314: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 aesbin[256]; data/yubikey-personalization-1.20.0/ykpers.c:331: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(cfg->ykcore_config.key, aesbin, i); data/yubikey-personalization-1.20.0/ykpers.c:332: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(cfg->ykcore_config.uid, aesbin + i, 20 - i); data/yubikey-personalization-1.20.0/ykpers.c:356: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[sizeof(cfg->ykcore_config.key) + 4]; data/yubikey-personalization-1.20.0/ykpers.c:367:4: [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(_salt, salt, _salt_len); data/yubikey-personalization-1.20.0/ykpers.c:372:25: [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). FILE *random_file = fopen(*random_place, "r"); data/yubikey-personalization-1.20.0/ykpers.c:408:5: [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(cfg->ykcore_config.uid, buf + sizeof(cfg->ykcore_config.key), 4); data/yubikey-personalization-1.20.0/ykpers.c:461: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(ndef->data + 1, uri, data_length); data/yubikey-personalization-1.20.0/ykpers.c:481: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(ndef->data + 1, lang, lang_length); data/yubikey-personalization-1.20.0/ykpers.c:482: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(ndef->data + lang_length + 1, text, data_length); data/yubikey-personalization-1.20.0/ykpers.c:502:4: [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(text, part, offset); data/yubikey-personalization-1.20.0/ykpers.c:504: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(text + offset, ndef->data + 1, ndef->len - 1); data/yubikey-personalization-1.20.0/ykpers.c:516: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(text, ndef->data + status + 1, ndef->len - status - 1); data/yubikey-personalization-1.20.0/ykpers.c:529: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(ndef->curAccCode, access_code, ACC_CODE_SIZE); data/yubikey-personalization-1.20.0/ykpers.c:775: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(cfg->ykcore_config.fieldname, (input), max_chars); \ data/yubikey-personalization-1.20.0/ykpers.c:934: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 buffer[256]; data/yubikey-personalization-1.20.0/ykpers.c:1134: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 buffer[1024]; data/yubikey-personalization-1.20.0/ykpersonalize.c:51:11: [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 access_code[256]; data/yubikey-personalization-1.20.0/ykpersonalize.c:54:11: [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 scan_codes[sizeof(SCAN_MAP)]; data/yubikey-personalization-1.20.0/ykpersonalize.c:55:11: [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 device_info[128]; data/yubikey-personalization-1.20.0/ykpersonalize.c:61: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 data[1024]; data/yubikey-personalization-1.20.0/ykpersonalize.c:65: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 oathid[128] = {0}; data/yubikey-personalization-1.20.0/ykpersonalize.c:66: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 ndef_string[128] = {0}; data/yubikey-personalization-1.20.0/ykpersonalize.c:90: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). key_index = atoi(optarg); data/yubikey-personalization-1.20.0/ykpersonalize.c:187: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 accbin[256]; data/yubikey-personalization-1.20.0/ykpersonalize.c:223:10: [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). inf = fopen(infname, "r"); data/yubikey-personalization-1.20.0/ykpersonalize.c:238:11: [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). outf = fopen(outfname, "w"); data/yubikey-personalization-1.20.0/ykpersonalize.c:264: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 commitbuf[256]; size_t commitlen; data/yubikey-personalization-1.20.0/ykpersonalize.c:295:4: [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(commitbuf, "yes"); data/yubikey-personalization-1.20.0/ykpersonalize.c:362: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(commitbuf, "yes"); data/yubikey-personalization-1.20.0/tests/test_json.c:68:37: [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). res = ykp_import_config(cfg, data, strlen(data), YKP_FORMAT_YCFG); data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:52:27: [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). assert(memcmp(uri, text, strlen(uri)) == 0); data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:80:27: [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). assert(memcmp(uri, text, strlen(uri)) == 0); data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:98:29: [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). assert(memcmp(text, text2, strlen(text)) == 0); data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:106:20: [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). size_t text_len = strlen(text); data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:117:29: [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). assert(memcmp(text, text2, strlen(text))); data/yubikey-personalization-1.20.0/tests/test_ndef_construction.c:134:27: [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). assert(memcmp(uri, text, strlen(uri)) == 0); data/yubikey-personalization-1.20.0/ykchalresp.c:183:20: [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). *challenge_len = strlen(argv[optind]); data/yubikey-personalization-1.20.0/ykcore/ykcore.c:42:18: [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. #define Sleep(x) usleep((x)*1000) data/yubikey-personalization-1.20.0/ykcore/ykcore.c:356:48: [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 _yk_write(yk, SLOT_SCAN_MAP, scan_map, strlen(SCAN_MAP)); data/yubikey-personalization-1.20.0/ykinfo.c:241:41: [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). yubikey_hex_decode(hex_serial, ptr, strlen(ptr)); data/yubikey-personalization-1.20.0/ykinfo.c:242:54: [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). yubikey_modhex_encode(modhex_serial, hex_serial, strlen(ptr)/2); data/yubikey-personalization-1.20.0/ykpbkdf2.c:84:40: [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 (!prf_method->prf_fn(passphrase, strlen(passphrase), data/yubikey-personalization-1.20.0/ykpers-args.c:234:12: [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). datalen = strlen(*data); data/yubikey-personalization-1.20.0/ykpers-args.c:448:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ndef, optarg, ndef_len); data/yubikey-personalization-1.20.0/ykpers-args.c:485:25: [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). size_t scanlength = strlen(SCAN_MAP); data/yubikey-personalization-1.20.0/ykpers-args.c:493: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). size_t scanlen = strlen (optarg); data/yubikey-personalization-1.20.0/ykpers-args.c:519: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). size_t len = strlen(optarg); data/yubikey-personalization-1.20.0/ykpers-args.c:520:70: [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). int rc = hex_modhex_decode(device_info, device_info_len, optarg, strlen(optarg), 2, 128, false); data/yubikey-personalization-1.20.0/ykpers-args.c:564: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). uidlen = strlen(uid); data/yubikey-personalization-1.20.0/ykpers-args.c:676:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(oathid, optarg, oathid_len); data/yubikey-personalization-1.20.0/ykpers-args.c:727:27: [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). size_t scanlength = strlen(SCAN_MAP); data/yubikey-personalization-1.20.0/ykpers-args.c:837:75: [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). int rc = hex_modhex_decode((unsigned char *)keybuf, &key_len, aeshash, strlen(aeshash), key_bytes * 2, key_bytes * 2, false); data/yubikey-personalization-1.20.0/ykpers-args.c:867:20: [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). size_t fixedlen = strlen (fixed); data/yubikey-personalization-1.20.0/ykpers-args.c:935: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(opt) > 7) { data/yubikey-personalization-1.20.0/ykpers-json.c:208:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(json, json_object_to_json_string_ext(jobj, JSON_C_TO_STRING_PRETTY), len); data/yubikey-personalization-1.20.0/ykpers-json.c:210:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(json, json_object_to_json_string(jobj), len); data/yubikey-personalization-1.20.0/ykpers-json.c:218:9: [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(json); data/yubikey-personalization-1.20.0/ykpers.c:270: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(hexkey) != 32) { data/yubikey-personalization-1.20.0/ykpers.c:318: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(hexkey) != 40) { data/yubikey-personalization-1.20.0/ykpers.c:364: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). _salt_len = strlen(salt); data/yubikey-personalization-1.20.0/ykpers.c:445: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). size_t len = strlen(ndef_identifiers[indx]); data/yubikey-personalization-1.20.0/ykpers.c:451: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). data_length = strlen(uri); data/yubikey-personalization-1.20.0/ykpers.c:470: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). size_t data_length = strlen(text); data/yubikey-personalization-1.20.0/ykpers.c:471: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). size_t lang_length = strlen(lang); data/yubikey-personalization-1.20.0/ykpers.c:495: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). offset = strlen(part); data/yubikey-personalization-1.20.0/ykpers.c:1003:4: [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(buffer, "n/a", 4); data/yubikey-personalization-1.20.0/ykpers.c:1049:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buffer, str_flags_separator, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1049:49: [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). strncat(buffer, str_flags_separator, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1051:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buffer, p->flag_text, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1051:41: [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). strncat(buffer, p->flag_text, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1068:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buffer, str_flags_separator, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1068:49: [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). strncat(buffer, str_flags_separator, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1070:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buffer, p->flag_text, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1070:41: [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). strncat(buffer, p->flag_text, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1090:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buffer, str_flags_separator, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1090:49: [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). strncat(buffer, str_flags_separator, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1092:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buffer, p->flag_text, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1092:41: [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). strncat(buffer, p->flag_text, 256 - strlen(buffer)); data/yubikey-personalization-1.20.0/ykpers.c:1137: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). writer(buffer, strlen(buffer), userdata); data/yubikey-personalization-1.20.0/ykpersonalize.c:171:15: [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). acc_code, strlen(acc_code), data/yubikey-personalization-1.20.0/ykpersonalize.c:190: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). new_acc_code, strlen(new_acc_code), data/yubikey-personalization-1.20.0/ykpersonalize.c:253:37: [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 (!ykp_import_config(cfg, data, strlen(data), data_format)) data/yubikey-personalization-1.20.0/ykpersonalize.c:260:24: [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(!(fwrite(data, 1, strlen(data), outf))) { data/yubikey-personalization-1.20.0/ykpersonalize.c:291:20: [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). fwrite(data, 1, strlen(data), stderr); data/yubikey-personalization-1.20.0/ykpersonalize.c:304:15: [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). commitlen = strlen(commitbuf); data/yubikey-personalization-1.20.0/ykpersonalize.c:371: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). commitlen = strlen(commitbuf); ANALYSIS SUMMARY: Hits = 178 Lines analyzed = 11748 in approximately 0.36 seconds (32622 lines/second) Physical Source Lines of Code (SLOC) = 7519 Hits@level = [0] 154 [1] 57 [2] 117 [3] 4 [4] 0 [5] 0 Hits@level+ = [0+] 332 [1+] 178 [2+] 121 [3+] 4 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 44.1548 [1+] 23.6734 [2+] 16.0926 [3+] 0.531986 [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.