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/openvr-1.12.5~ds1/headers/openvr.h Examining data/openvr-1.12.5~ds1/headers/openvr_capi.h Examining data/openvr-1.12.5~ds1/headers/openvr_driver.h Examining data/openvr-1.12.5~ds1/src/ivrclientcore.h Examining data/openvr-1.12.5~ds1/src/openvr_api_public.cpp Examining data/openvr-1.12.5~ds1/src/vrcommon/dirtools_public.cpp Examining data/openvr-1.12.5~ds1/src/vrcommon/dirtools_public.h Examining data/openvr-1.12.5~ds1/src/vrcommon/envvartools_public.cpp Examining data/openvr-1.12.5~ds1/src/vrcommon/envvartools_public.h Examining data/openvr-1.12.5~ds1/src/vrcommon/hmderrors_public.cpp Examining data/openvr-1.12.5~ds1/src/vrcommon/hmderrors_public.h Examining data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp Examining data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.h Examining data/openvr-1.12.5~ds1/src/vrcommon/sharedlibtools_public.cpp Examining data/openvr-1.12.5~ds1/src/vrcommon/sharedlibtools_public.h Examining data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.cpp Examining data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.h Examining data/openvr-1.12.5~ds1/src/vrcommon/vrpathregistry_public.h Examining data/openvr-1.12.5~ds1/src/vrcommon/vrpathregistry_public.cpp Examining data/openvr-1.12.5~ds1/thirdparty/jsoncpp/json/json-forwards.h Examining data/openvr-1.12.5~ds1/thirdparty/jsoncpp/json/json.h Examining data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp FINAL RESULTS: data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:58:18: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ssize_t nRead = readlink("/proc/self/exe", rchPath, nBuff-1 ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:770:12: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. return ( chmod( strFilename.c_str(), sb.st_mode | S_IWUSR ) == 0 ); data/openvr-1.12.5~ds1/src/vrcommon/dirtools_public.cpp:35:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy( path, pchPath ); data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.h:62:22: [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. #define _vsnprintf_s vsnprintf data/openvr-1.12.5~ds1/src/vrcommon/vrpathregistry_public.cpp:29:27: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define VRLog(args...) fprintf(stderr, args) data/openvr-1.12.5~ds1/src/vrcommon/vrpathregistry_public.cpp:31:28: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define VRLog(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) data/openvr-1.12.5~ds1/src/vrcommon/vrpathregistry_public.cpp:33:27: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define VRLog(args...) fprintf(stderr, args) data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:211:9: [4] (format) snprintf: 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. #define snprintf sprintf_s data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:213:9: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:213:23: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:215:9: [4] (format) snprintf: 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. #define snprintf _snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:215:18: [4] (format) _snprintf: 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. #define snprintf _snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:218:9: [4] (format) snprintf: 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. #define snprintf snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:218:18: [4] (format) snprintf: 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. #define snprintf snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:220:9: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:220:23: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:224:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. #define sscanf std::sscanf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:224:21: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. #define sscanf std::sscanf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:1821:13: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. count = sscanf(buffer, format, &value); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:1824:13: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. count = sscanf(buffer.c_str(), format, &value); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4094:9: [4] (format) snprintf: 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. #define snprintf sprintf_s data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4096:9: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4096:23: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4098:9: [4] (format) snprintf: 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. #define snprintf _snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4098:18: [4] (format) _snprintf: 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. #define snprintf _snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4101:9: [4] (format) snprintf: 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. #define snprintf snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4101:18: [4] (format) snprintf: 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. #define snprintf snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4103:9: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4103:23: [4] (format) snprintf: 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. #define snprintf std::snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4109:9: [4] (format) snprintf: 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. #define snprintf _snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4109:18: [4] (format) _snprintf: 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. #define snprintf _snprintf data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4192:11: [4] (format) snprintf: 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 = snprintf(buffer, sizeof(buffer), formatString, value); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4196:13: [4] (format) snprintf: 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 = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null"); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4198:13: [4] (format) snprintf: 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 = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999"); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4200:13: [4] (format) snprintf: 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 = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999"); data/openvr-1.12.5~ds1/src/vrcommon/envvartools_public.cpp:26:19: [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. char *pchValue = getenv( pchVarName ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:111:26: [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 *pchTmpDir = getenv( "TMPDIR" ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:913:24: [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 *pchHome = getenv( "HOME" ); data/openvr-1.12.5~ds1/src/vrcommon/sharedlibtools_public.cpp:16:26: [3] (misc) LoadLibraryEx: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. return (SharedLibHandle)LoadLibraryEx( pchPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ); data/openvr-1.12.5~ds1/src/vrcommon/vrpathregistry_public.cpp:78:24: [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 *pchHome = getenv("XDG_CONFIG_HOME"); data/openvr-1.12.5~ds1/src/vrcommon/vrpathregistry_public.cpp:87:12: [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. pchHome = getenv( "HOME" ); data/openvr-1.12.5~ds1/headers/openvr.h:1046: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 cNewInput[8]; // Up to 11 bytes of new input data/openvr-1.12.5~ds1/headers/openvr.h:2622: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[4096]; data/openvr-1.12.5~ds1/headers/openvr.h:4733: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 rchRenderModelComponentName[128]; data/openvr-1.12.5~ds1/headers/openvr.h:4738: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 rchDevicePathName[128]; data/openvr-1.12.5~ds1/headers/openvr.h:4739: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 rchInputPathName[128]; data/openvr-1.12.5~ds1/headers/openvr.h:4740: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 rchModeName[128]; data/openvr-1.12.5~ds1/headers/openvr.h:4741: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 rchSlotName[128]; data/openvr-1.12.5~ds1/headers/openvr.h:4742: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 rchInputSourceType[ 32 ]; data/openvr-1.12.5~ds1/headers/openvr_capi.h:2002: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 cNewInput[8]; //char[8] data/openvr-1.12.5~ds1/headers/openvr_capi.h:2410: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 rchRenderModelComponentName[128]; //char[128] data/openvr-1.12.5~ds1/headers/openvr_capi.h:2415: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 rchDevicePathName[128]; //char[128] data/openvr-1.12.5~ds1/headers/openvr_capi.h:2416: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 rchInputPathName[128]; //char[128] data/openvr-1.12.5~ds1/headers/openvr_capi.h:2417: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 rchModeName[128]; //char[128] data/openvr-1.12.5~ds1/headers/openvr_capi.h:2418: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 rchSlotName[128]; //char[128] data/openvr-1.12.5~ds1/headers/openvr_capi.h:2419: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 rchInputSourceType[32]; //char[32] data/openvr-1.12.5~ds1/headers/openvr_driver.h:1046: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 cNewInput[8]; // Up to 11 bytes of new input data/openvr-1.12.5~ds1/headers/openvr_driver.h:2204: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[4096]; data/openvr-1.12.5~ds1/headers/openvr_driver.h:3106:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/openvr-1.12.5~ds1/src/openvr_api_public.cpp:271: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 rchBuffer[1024]; data/openvr-1.12.5~ds1/src/vrcommon/envvartools_public.cpp:19: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 rchValue[32767]; // max size for an env var on Windows data/openvr-1.12.5~ds1/src/vrcommon/envvartools_public.cpp:67:10: [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). return atoi( sValue.c_str() ) != 0; data/openvr-1.12.5~ds1/src/vrcommon/hmderrors_public.cpp: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. static char buf[128]; data/openvr-1.12.5~ds1/src/vrcommon/hmderrors_public.cpp:321:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( buf, "Unknown error (%d)", eError ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:47: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 rchPath[1024]; data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:56: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 rchPath[1024]; data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:80:2: [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 buf[MAX_UNICODE_PATH]; data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:83:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[ 1024 ]; data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:106:2: [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 buf[MAX_UNICODE_PATH]; data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:598:6: [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). f = fopen( strFilename.c_str(), "rb" ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:633:6: [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). f = fopen( strFilename.c_str(), "rb" ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:670:6: [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). f = fopen( strFilename.c_str(), "rb" ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:710:6: [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). f = fopen(strFilename.c_str(), "wb"); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:781:6: [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). f = fopen( strFilename.c_str(), "w" ); data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.cpp:109:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszStr, -1, vecBuf.data(), (int) vecBuf.size() ); data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.cpp:168: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( pchBuffer, sValue.c_str(), unLen ); data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.cpp:178:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[ 22 ]; data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:142: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. typedef char UIntToStringBuffer[uintToStringBufferSize]; data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:999: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[18 + 16 + 16 + 1]; data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:1819: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(buffer, token.start_, length); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:2020: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[18 + 16 + 16 + 1]; data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:2472:23: [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 const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 }; data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:2533: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(newString, value, length); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:2557: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(newString + sizeof(unsigned), value, length); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4182: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[32]; data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4185: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 formatString[6]; data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4186:3: [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(formatString, "%%.%dg", precision); data/openvr-1.12.5~ds1/src/vrcommon/dirtools_public.cpp:33:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = (int)strlen( pchPath ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:869:53: [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 ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) ) data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:873: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). sFileUrl.c_str() + strlen( FILE_URL_PREFIX ), (int)( sFileUrl.length() - strlen( FILE_URL_PREFIX ) ) ); data/openvr-1.12.5~ds1/src/vrcommon/pathtools_public.cpp:873:77: [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). sFileUrl.c_str() + strlen( FILE_URL_PREFIX ), (int)( sFileUrl.length() - strlen( FILE_URL_PREFIX ) ) ); data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.cpp:108:32: [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). std::vector<wchar_t> vecBuf( strlen( pszStr ) + 1 ); // should be guaranteed to be enough data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.cpp:120:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( pchBuffer, pchSource, unBufferSizeBytes - 1 ); data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.h:91:2: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(strDest, strSource, numberOfElements); data/openvr-1.12.5~ds1/src/vrcommon/strtools_public.h:97:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(strDest, strSource, numberOfElements); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:2566: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). *length = static_cast<unsigned>(strlen(prefixed)); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:2795:79: [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). value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value))); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:2866:36: [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). otherComment.comment_, strlen(otherComment.comment_)); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3446:34: [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). key, static_cast<unsigned>(strlen(key)), CZString::noDuplication); // NOTE! data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3506: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). Value const* found = find(key, key + strlen(key)); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3518:38: [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 resolveReference(key, key + strlen(key)); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3559: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). return get(key, key + strlen(key), defaultValue); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3582:34: [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 removeMember(key, key + strlen(key), removed); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3596: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). removeMember(key, key + strlen(key), &removed); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3641: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). return isMember(key, key + strlen(key)); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:3804: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). setComment(comment, strlen(comment), placement); data/openvr-1.12.5~ds1/thirdparty/jsoncpp/jsoncpp.cpp:4224:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(value) * 2 + 3; // allescaped+quotes+NULL ANALYSIS SUMMARY: Hits = 107 Lines analyzed = 23552 in approximately 1.42 seconds (16611 lines/second) Physical Source Lines of Code (SLOC) = 16541 Hits@level = [0] 8 [1] 20 [2] 46 [3] 6 [4] 33 [5] 2 Hits@level+ = [0+] 115 [1+] 107 [2+] 87 [3+] 41 [4+] 35 [5+] 2 Hits/KSLOC@level+ = [0+] 6.95242 [1+] 6.46877 [2+] 5.25966 [3+] 2.47869 [4+] 2.11595 [5+] 0.120912 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.