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/libbdplus-0.1.2/src/examples/bdplus_test.c Examining data/libbdplus-0.1.2/src/examples/convtab_dump.c Examining data/libbdplus-0.1.2/src/file/file.h Examining data/libbdplus-0.1.2/src/file/file_default.c Examining data/libbdplus-0.1.2/src/file/dirs_darwin.c Examining data/libbdplus-0.1.2/src/file/dirs_win32.c Examining data/libbdplus-0.1.2/src/file/file_default.h Examining data/libbdplus-0.1.2/src/file/configfile.c Examining data/libbdplus-0.1.2/src/file/filesystem.h Examining data/libbdplus-0.1.2/src/file/dirs_xdg.c Examining data/libbdplus-0.1.2/src/file/configfile.h Examining data/libbdplus-0.1.2/src/file/dirs.h Examining data/libbdplus-0.1.2/src/util/strutl.h Examining data/libbdplus-0.1.2/src/util/logging.c Examining data/libbdplus-0.1.2/src/util/macro.h Examining data/libbdplus-0.1.2/src/util/mutex.c Examining data/libbdplus-0.1.2/src/util/logging.h Examining data/libbdplus-0.1.2/src/util/strutl.c Examining data/libbdplus-0.1.2/src/util/attributes.h Examining data/libbdplus-0.1.2/src/util/mutex.h Examining data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/loader.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/slot.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/event.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap_helper.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/interface.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/loader.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/slot_data.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/event.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/slot.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/sha1.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/dlx_internal.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap_helper.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/dlx.c Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/interface.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/dlx.h Examining data/libbdplus-0.1.2/src/libbdplus/bdsvm/sha1.h Examining data/libbdplus-0.1.2/src/libbdplus/bdplus-version.h Examining data/libbdplus-0.1.2/src/libbdplus/bdplus.h Examining data/libbdplus-0.1.2/src/libbdplus/internal.h Examining data/libbdplus-0.1.2/src/libbdplus/bdplus_data.h Examining data/libbdplus-0.1.2/src/libbdplus/bdplus_config.h Examining data/libbdplus-0.1.2/src/libbdplus/internal.c Examining data/libbdplus-0.1.2/src/libbdplus/bdplus.c FINAL RESULTS: data/libbdplus-0.1.2/src/file/dirs_xdg.c:102:13: [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(dirs, xdg_sys); data/libbdplus-0.1.2/src/libbdplus/bdplus.c:154: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(plus->device_path, path); data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.c:178:5: [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 *)&namehash[sizeof(offset)+sizeof(*len)], data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:489:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(strfmt_key, data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:534:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(strfmt_key, data/libbdplus-0.1.2/src/util/logging.c:68:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pt += sprintf(buffer, "%s:%d: ", f ? f + 1 : file, line); data/libbdplus-0.1.2/src/util/logging.c:71:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(pt, sizeof(buffer) - (size_t)(intptr_t)(pt - buffer) - 1, format, args); data/libbdplus-0.1.2/src/util/strutl.c:36:16: [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). return str ? strcpy (malloc(strlen(str) + 1), str) : NULL; data/libbdplus-0.1.2/src/util/strutl.c:52:15: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. len = vsnprintf(str, size, fmt, ap); data/libbdplus-0.1.2/src/file/configfile.c:116:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. vm = getenv("BDPLUS_VM_ID"); data/libbdplus-0.1.2/src/file/dirs_darwin.c:43:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libbdplus-0.1.2/src/file/dirs_darwin.c:54:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libbdplus-0.1.2/src/file/dirs_darwin.c:65:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libbdplus-0.1.2/src/file/dirs_xdg.c:46:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_home = getenv("XDG_CONFIG_HOME"); data/libbdplus-0.1.2/src/file/dirs_xdg.c:51:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libbdplus-0.1.2/src/file/dirs_xdg.c:62:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_home = getenv("XDG_DATA_HOME"); data/libbdplus-0.1.2/src/file/dirs_xdg.c:67:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libbdplus-0.1.2/src/file/dirs_xdg.c:78:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_cache = getenv("XDG_CACHE_HOME"); data/libbdplus-0.1.2/src/file/dirs_xdg.c:83:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libbdplus-0.1.2/src/file/dirs_xdg.c:97:31: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_sys = getenv("XDG_CONFIG_DIRS"); data/libbdplus-0.1.2/src/util/logging.c:48:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((env = getenv("BD_DEBUG_MASK"))) data/libbdplus-0.1.2/src/util/logging.c:52:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((env = getenv("BD_DEBUG_FILE"))) { data/libbdplus-0.1.2/src/util/mutex.h:43:5: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(p); data/libbdplus-0.1.2/src/util/mutex.h:59:5: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(p); data/libbdplus-0.1.2/src/examples/bdplus_test.c:75: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(vid, aacs_vid, 16); data/libbdplus-0.1.2/src/examples/bdplus_test.c:83: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(mk, aacs_mk, 16); data/libbdplus-0.1.2/src/examples/convtab_dump.c:36:16: [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 *fp = fopen(file, "rb"); data/libbdplus-0.1.2/src/file/configfile.c:95:17: [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 *fp = fopen(dir, "r"); data/libbdplus-0.1.2/src/file/configfile.c:179: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). fp = fopen(path, "rb"); data/libbdplus-0.1.2/src/file/dirs_win32.c:39:5: [2] (buffer) wchar_t: 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. wchar_t wdir[MAX_PATH]; data/libbdplus-0.1.2/src/file/dirs_win32.c:41:5: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, dir, -1, wdir, MAX_PATH); data/libbdplus-0.1.2/src/file/dirs_win32.c:52:5: [2] (buffer) wchar_t: 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. wchar_t wdir[MAX_PATH]; data/libbdplus-0.1.2/src/file/dirs_win32.c:75:5: [2] (buffer) wchar_t: 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. wchar_t wdir[MAX_PATH]; data/libbdplus-0.1.2/src/file/file.h:41:37: [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). #define file_open(cfg, fname) (cfg->fopen(cfg->fopen_handle, fname)) data/libbdplus-0.1.2/src/file/file_default.c:66: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). fp = fopen(file_path, "rb"); data/libbdplus-0.1.2/src/libbdplus/bdplus.c:60:24: [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). if (!plus->config->fopen) { data/libbdplus-0.1.2/src/libbdplus/bdplus.c:163:23: [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). if (plus->config->fopen) { data/libbdplus-0.1.2/src/libbdplus/bdplus.c:241:20: [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 *fp = fopen(file, "wb"); data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:60: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(aes_keys[ii].key, keys + 16*ii, 16); data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:80: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 key_d[41], key_Qx[41], key_Qy[41]; data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:91:13: [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(ecdsa_keys[num_ecdsa_keys].d, key_d, 40); data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:92:13: [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(ecdsa_keys[num_ecdsa_keys].Qx, key_Qx, 40); data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:93:13: [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(ecdsa_keys[num_ecdsa_keys].Qy, key_Qy, 40); data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:211: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 name[64]; data/libbdplus-0.1.2/src/libbdplus/bdplus_config.h:59: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 d[41]; data/libbdplus-0.1.2/src/libbdplus/bdplus_config.h:60: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 Qx[41]; data/libbdplus-0.1.2/src/libbdplus/bdplus_config.h:61: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 Qy[41]; data/libbdplus-0.1.2/src/libbdplus/bdplus_config.h:68: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 key[16]; data/libbdplus-0.1.2/src/libbdplus/bdplus_config.h:76: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). BDPLUS_FILE_OPEN fopen; data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.c:79: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). fd = fopen(fname, "rb"); data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.c:167: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). fd = fopen((char *)hashname, "rb"); data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.c:181: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 str[512]; data/libbdplus-0.1.2/src/libbdplus/bdsvm/interface.c:699:13: [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/libbdplus-0.1.2/src/libbdplus/bdsvm/interface.c:721:13: [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(&vm->addr[ dst & ADDR_MASK1 ], data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:547: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( &set1->Tables[ i ], data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:595: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 str[128]; data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:703:17: [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(&segment->Entries[ i ], data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:1157:21: [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, &entry->patch0[ diff ], data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:1168:21: [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[ len - diff ], entry->patch0, (size_t)diff); data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:1172:21: [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[ len - diff ], entry->patch0, data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:1189:21: [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, &entry->patch1[ diff ], data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:1200:21: [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[ len - diff ], entry->patch1, (size_t)diff); data/libbdplus-0.1.2/src/libbdplus/bdsvm/segment.c:1204:21: [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[ len - diff ], entry->patch1, data/libbdplus-0.1.2/src/libbdplus/bdsvm/sha1.c:141: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(block, buffer, 64); data/libbdplus-0.1.2/src/libbdplus/bdsvm/sha1.c:214: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(&context->buffer[j], data, (i = 64-j)); data/libbdplus-0.1.2/src/libbdplus/bdsvm/sha1.c:222: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(&context->buffer[j], &data[i], len - i); data/libbdplus-0.1.2/src/libbdplus/bdsvm/slot.c:93: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(&hash[8], codeStart, 16); data/libbdplus-0.1.2/src/libbdplus/bdsvm/slot.c:94: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(&hash[24], PCp, codeLen * sizeof(uint32_t) ); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:75:14: [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). fd = fopen("dat/conv_tab2.bin", "wb"); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:138: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 errstr[100]; data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:358: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 errstr[100]; data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.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(message, "BDSVM_PK", 8); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:412: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(&message[ 16 ], src, srcLen); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:626: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(dst, r, 20); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:627: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(dst + 20, s, 20); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:721: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(dst + 20, sha->buffer, (sha->count[0] >> 3) & 63); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:769: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(dst, digest, sizeof(digest)); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:1066:13: [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(pBuf, config->dev[0].mem, len); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:1074:13: [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(pBuf, config->dev[1].mem, len); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:1082:13: [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(pBuf, config->dev[2].mem, len); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:1085:13: [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(&pBuf[24], volumeID, 16); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:1117:13: [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(pBuf, config->dev[3].mem, len); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:1124:13: [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(pBuf, config->dev[4].mem, len); data/libbdplus-0.1.2/src/libbdplus/internal.c:72: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 vid_str[33]; data/libbdplus-0.1.2/src/libbdplus/internal.c:103: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). fd = fopen(fname, "rb"); data/libbdplus-0.1.2/src/libbdplus/internal.c:124: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). fd = fopen(fname, "wb"); data/libbdplus-0.1.2/src/libbdplus/internal.c:156: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(dst, &plus->slots[ slot ], sizeof(slot_t)); data/libbdplus-0.1.2/src/libbdplus/internal.c:235: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(&plus->slots[ plus->attached_slot ], slot, sizeof(slot_t)); data/libbdplus-0.1.2/src/util/logging.c:53:24: [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 *fp = fopen(env, "wb"); data/libbdplus-0.1.2/src/util/logging.c:65: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 buffer[4096], *pt = buffer; data/libbdplus-0.1.2/src/util/strutl.c:99: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. sprintf(out + (zz * 2), "%02x", buf[zz]); data/libbdplus-0.1.2/src/file/dirs_darwin.c:87: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). dir += strlen(dir) + 1; data/libbdplus-0.1.2/src/file/dirs_xdg.c:101:30: [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). dirs = calloc(1, strlen(xdg_sys) + 2); data/libbdplus-0.1.2/src/file/dirs_xdg.c:119: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). dir += strlen(dir) + 1; data/libbdplus-0.1.2/src/file/file.h:39:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define file_read(X,Y,Z) X->read(X,Y,Z) data/libbdplus-0.1.2/src/file/filesystem.h:35:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int64_t (*read) (BDPLUS_FILE_H *file, uint8_t *buf, int64_t size); data/libbdplus-0.1.2/src/libbdplus/bdplus.c:153:43: [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). plus->device_path = (char*)malloc(strlen(path) + 1); data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:86:23: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. else if (3 == sscanf(p, "%40s %40s %40s", key_d, key_Qx, key_Qy)) { data/libbdplus-0.1.2/src/libbdplus/bdplus_config.c:218:23: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. else if (2 == sscanf(p, "%x %63s", &address, name)) { data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.c:60: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). len = strlen(fname); data/libbdplus-0.1.2/src/libbdplus/bdsvm/diff.c:171:46: [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). shalen = sizeof(offset) + sizeof(*len) + strlen((char *)fname) + 1; data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:485: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). strlen(CA_x_Q0) + data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:486: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). strlen(CA_y_Q0) + data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:488:28: [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). sizeof("(d #00") + strlen(CA_d0) + sizeof("#)))") + 1); data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:530: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). strlen(CA_x_Q1) + data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:531: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). strlen(CA_y_Q1) + data/libbdplus-0.1.2/src/libbdplus/bdsvm/trap.c:533:28: [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). sizeof("(d #00") + strlen(CA_d1) + sizeof("#)))") + 1); data/libbdplus-0.1.2/src/util/strutl.c:36:31: [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 str ? strcpy (malloc(strlen(str) + 1), str) : NULL; ANALYSIS SUMMARY: Hits = 108 Lines analyzed = 9440 in approximately 0.29 seconds (32092 lines/second) Physical Source Lines of Code (SLOC) = 5579 Hits@level = [0] 53 [1] 17 [2] 67 [3] 15 [4] 9 [5] 0 Hits@level+ = [0+] 161 [1+] 108 [2+] 91 [3+] 24 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 28.8582 [1+] 19.3583 [2+] 16.3112 [3+] 4.30185 [4+] 1.61319 [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.