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/ocl-icd-2.2.13/khronos-headers/CL/cl.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_d3d10.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_d3d11.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_dx9_media_sharing.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_dx9_media_sharing_intel.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_egl.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_ext.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_ext_intel.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_gl.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_gl_ext.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_half.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_icd.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_platform.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_va_api_media_sharing_intel.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/cl_version.h Examining data/ocl-icd-2.2.13/khronos-headers/CL/opencl.h Examining data/ocl-icd-2.2.13/libdummy_icd.c Examining data/ocl-icd-2.2.13/libdummy_icd.h Examining data/ocl-icd-2.2.13/ocl_icd_debug.h Examining data/ocl-icd-2.2.13/ocl_icd_loader.c Examining data/ocl-icd-2.2.13/ocl_icd_loader.h Examining data/ocl-icd-2.2.13/ocl_test.c Examining data/ocl-icd-2.2.13/ocl_test_icdl.c Examining data/ocl-icd-2.2.13/run_dummy_icd.c FINAL RESULTS: data/ocl-icd-2.2.13/ocl_icd_loader.c:208:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(lib_path,"%s/%s", dir_path, file_path); data/ocl-icd-2.2.13/ocl_icd_loader.c:212:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(lib_path,"%s", file_path); data/ocl-icd-2.2.13/ocl_test_icdl.c:82:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(#name ": %s\n",param_value); \ data/ocl-icd-2.2.13/libdummy_icd.c:172:11: [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 (getenv("EMULATE_INTEL_ICD")) { data/ocl-icd-2.2.13/libdummy_icd.c:224:15: [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* strnb=getenv(ENVNAME); data/ocl-icd-2.2.13/libdummy_icd.c:226:14: [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. *res=atoi(getenv(ENVNAME)); data/ocl-icd-2.2.13/ocl_icd_debug.h:86:17: [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 *debug=getenv("OCL_ICD_DEBUG"); data/ocl-icd-2.2.13/ocl_icd_loader.c:372:18: [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* ocl_sort=getenv("OCL_ICD_PLATFORM_SORT"); data/ocl-icd-2.2.13/ocl_icd_loader.c:400: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. const char* str=getenv("OCL_ICD_ASSUME_ICD_EXTENSION"); data/ocl-icd-2.2.13/ocl_icd_loader.c:589: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* dir_path=getenv("OCL_ICD_VENDORS"); data/ocl-icd-2.2.13/ocl_icd_loader.c:590:27: [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* vendor_path=getenv("OPENCL_VENDOR_PATH"); data/ocl-icd-2.2.13/ocl_icd_loader.c:743:38: [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 *default_platform = getenv("OCL_ICD_DEFAULT_PLATFORM"); data/ocl-icd-2.2.13/khronos-headers/CL/cl.h:173: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 name[CL_NAME_VERSION_MAX_NAME_SIZE]; data/ocl-icd-2.2.13/khronos-headers/CL/cl_ext.h:621: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 name[CL_NAME_VERSION_MAX_NAME_SIZE_KHR]; data/ocl-icd-2.2.13/libdummy_icd.c:190: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(param_value, string_p, size_string); data/ocl-icd-2.2.13/libdummy_icd.c:226:9: [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). *res=atoi(getenv(ENVNAME)); data/ocl-icd-2.2.13/ocl_icd_debug.h:88:26: [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). debug_ocl_icd_mask=atoi(debug); data/ocl-icd-2.2.13/ocl_icd_loader.c:75:8: [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 const * const clErrorStr[MAX_CL_ERRORS+1] = { data/ocl-icd-2.2.13/ocl_icd_loader.c:153:10: [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 number[15]; data/ocl-icd-2.2.13/ocl_icd_loader.c:215: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). FILE *f = fopen(lib_path,"r"); data/ocl-icd-2.2.13/ocl_icd_loader.c:807: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(param_value, string_p, size_string); data/ocl-icd-2.2.13/ocl_icd_loader.c:163: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(str); data/ocl-icd-2.2.13/ocl_icd_loader.c:206: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). lib_path_length = strlen(dir_path) + strlen(file_path) + 2; data/ocl-icd-2.2.13/ocl_icd_loader.c:206:42: [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). lib_path_length = strlen(dir_path) + strlen(file_path) + 2; data/ocl-icd-2.2.13/ocl_icd_loader.c:210: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). lib_path_length = strlen(file_path) + 1; data/ocl-icd-2.2.13/ocl_icd_loader.c:824: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). int lenfn=strlen(func_name); data/ocl-icd-2.2.13/ocl_icd_loader.c:834:21: [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). suffix_length = strlen(_picds[i].extension_suffix); data/ocl-icd-2.2.13/ocl_icd_loader.c:835: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). if( suffix_length > strlen(func_name) ) data/ocl-icd-2.2.13/ocl_icd_loader.c:837: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). if(strcmp(_picds[i].extension_suffix, &func_name[strlen(func_name)-suffix_length]) == 0) ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 9410 in approximately 0.21 seconds (43918 lines/second) Physical Source Lines of Code (SLOC) = 6816 Hits@level = [0] 14 [1] 8 [2] 9 [3] 9 [4] 3 [5] 0 Hits@level+ = [0+] 43 [1+] 29 [2+] 21 [3+] 12 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 6.30869 [1+] 4.25469 [2+] 3.08099 [3+] 1.76056 [4+] 0.440141 [5+] 0 Symlinks skipped = 1 (--allowlink overrides but see doc for security issue) 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.