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/lilv-0.24.10/bindings/test/bindings_test_plugin.c Examining data/lilv-0.24.10/lilv/lilv.h Examining data/lilv-0.24.10/lilv/lilvmm.hpp Examining data/lilv-0.24.10/src/collections.c Examining data/lilv-0.24.10/src/filesystem.c Examining data/lilv-0.24.10/src/filesystem.h Examining data/lilv-0.24.10/src/instance.c Examining data/lilv-0.24.10/src/lib.c Examining data/lilv-0.24.10/src/lilv_internal.h Examining data/lilv-0.24.10/src/node.c Examining data/lilv-0.24.10/src/plugin.c Examining data/lilv-0.24.10/src/pluginclass.c Examining data/lilv-0.24.10/src/port.c Examining data/lilv-0.24.10/src/query.c Examining data/lilv-0.24.10/src/scalepoint.c Examining data/lilv-0.24.10/src/state.c Examining data/lilv-0.24.10/src/ui.c Examining data/lilv-0.24.10/src/util.c Examining data/lilv-0.24.10/src/world.c Examining data/lilv-0.24.10/src/zix/common.h Examining data/lilv-0.24.10/src/zix/tree.c Examining data/lilv-0.24.10/src/zix/tree.h Examining data/lilv-0.24.10/test/bad_syntax.lv2/bad_syntax.c Examining data/lilv-0.24.10/test/bad_syntax.lv2/test_bad_syntax.c Examining data/lilv-0.24.10/test/failed_instantiation.lv2/failed_instantiation.c Examining data/lilv-0.24.10/test/failed_instantiation.lv2/test_failed_instantiation.c Examining data/lilv-0.24.10/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c Examining data/lilv-0.24.10/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c Examining data/lilv-0.24.10/test/lib_descriptor.lv2/lib_descriptor.c Examining data/lilv-0.24.10/test/lib_descriptor.lv2/test_lib_descriptor.c Examining data/lilv-0.24.10/test/lilv_cxx_test.cpp Examining data/lilv-0.24.10/test/lilv_test_utils.c Examining data/lilv-0.24.10/test/lilv_test_utils.h Examining data/lilv-0.24.10/test/missing_descriptor.lv2/missing_descriptor.c Examining data/lilv-0.24.10/test/missing_descriptor.lv2/test_missing_descriptor.c Examining data/lilv-0.24.10/test/missing_name.lv2/missing_name.c Examining data/lilv-0.24.10/test/missing_name.lv2/test_missing_name.c Examining data/lilv-0.24.10/test/missing_plugin.lv2/missing_plugin.c Examining data/lilv-0.24.10/test/missing_plugin.lv2/test_missing_plugin.c Examining data/lilv-0.24.10/test/missing_port.lv2/missing_port.c Examining data/lilv-0.24.10/test/missing_port.lv2/test_missing_port.c Examining data/lilv-0.24.10/test/missing_port_name.lv2/missing_port_name.c Examining data/lilv-0.24.10/test/missing_port_name.lv2/test_missing_port_name.c Examining data/lilv-0.24.10/test/new_version.lv2/new_version.c Examining data/lilv-0.24.10/test/old_version.lv2/old_version.c Examining data/lilv-0.24.10/test/test.lv2/test.c Examining data/lilv-0.24.10/test/test_bad_port_index.c Examining data/lilv-0.24.10/test/test_bad_port_symbol.c Examining data/lilv-0.24.10/test/test_classes.c Examining data/lilv-0.24.10/test/test_discovery.c Examining data/lilv-0.24.10/test/test_filesystem.c Examining data/lilv-0.24.10/test/test_get_symbol.c Examining data/lilv-0.24.10/test/test_no_author.c Examining data/lilv-0.24.10/test/test_no_verify.c Examining data/lilv-0.24.10/test/test_plugin.c Examining data/lilv-0.24.10/test/test_port.c Examining data/lilv-0.24.10/test/test_preset.c Examining data/lilv-0.24.10/test/test_project.c Examining data/lilv-0.24.10/test/test_project_no_author.c Examining data/lilv-0.24.10/test/test_prototype.c Examining data/lilv-0.24.10/test/test_reload_bundle.c Examining data/lilv-0.24.10/test/test_replace_version.c Examining data/lilv-0.24.10/test/test_state.c Examining data/lilv-0.24.10/test/test_string.c Examining data/lilv-0.24.10/test/test_ui.c Examining data/lilv-0.24.10/test/test_util.c Examining data/lilv-0.24.10/test/test_value.c Examining data/lilv-0.24.10/test/test_verify.c Examining data/lilv-0.24.10/test/test_world.c Examining data/lilv-0.24.10/utils/bench.h Examining data/lilv-0.24.10/utils/lilv-bench.c Examining data/lilv-0.24.10/utils/lv2apply.c Examining data/lilv-0.24.10/utils/lv2bench.c Examining data/lilv-0.24.10/utils/lv2info.c Examining data/lilv-0.24.10/utils/lv2ls.c Examining data/lilv-0.24.10/utils/uri_table.h FINAL RESULTS: data/lilv-0.24.10/src/filesystem.c:240:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return !access(path, F_OK); data/lilv-0.24.10/src/lilv_internal.h:44:17: [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. # ifndef snprintf data/lilv-0.24.10/src/lilv_internal.h:45:21: [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/lilv-0.24.10/src/lilv_internal.h:45:30: [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/lilv-0.24.10/src/lilv_internal.h:410:31: [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 LILV_ERROR(str) fprintf(stderr, "%s(): error: " str, \ data/lilv-0.24.10/src/lilv_internal.h:412:31: [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 LILV_ERRORF(fmt, ...) fprintf(stderr, "%s(): error: " fmt, \ data/lilv-0.24.10/src/lilv_internal.h:414:31: [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 LILV_WARN(str) fprintf(stderr, "%s(): warning: " str, \ data/lilv-0.24.10/src/lilv_internal.h:416:31: [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 LILV_WARNF(fmt, ...) fprintf(stderr, "%s(): warning: " fmt, \ data/lilv-0.24.10/src/lilv_internal.h:418:31: [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 LILV_NOTE(str) fprintf(stderr, "%s(): note: " str, \ data/lilv-0.24.10/src/lilv_internal.h:420:31: [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 LILV_NOTEF(fmt, ...) fprintf(stderr, "%s(): note: " fmt, \ data/lilv-0.24.10/src/util.c:247:6: [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. if (sscanf(entry_path, latest->pattern, &num) == 1) { data/lilv-0.24.10/src/zix/tree.c:62:36: [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. # define DEBUG_PRINTF(fmt, ...) printf(fmt, __VA_ARGS__) data/lilv-0.24.10/utils/lv2apply.c:31:60: [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. # define LILV_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1))) data/lilv-0.24.10/utils/lv2apply.c:137:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/lilv-0.24.10/src/filesystem.c:85: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* const tmpdir = getenv("TMPDIR"); data/lilv-0.24.10/src/filesystem.c:228:20: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char* real_path = realpath(path, NULL); data/lilv-0.24.10/src/lilv_internal.h:40:33: [3] (misc) LoadLibrary: 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. # define dlopen(path, flags) LoadLibrary(path) data/lilv-0.24.10/src/util.c:108: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* const env_lang = getenv("LANG"); data/lilv-0.24.10/src/util.c:156: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. const char* val = getenv(var); data/lilv-0.24.10/src/world.c:1076: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. lv2_path = getenv("LV2_PATH"); data/lilv-0.24.10/test/test_string.c:40:32: [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* home_foo = lilv_strjoin(getenv("HOME"), "/foo", NULL); data/lilv-0.24.10/test/test_string.c:43:41: [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. assert(!strcmp((s = lilv_expand("~")), getenv("HOME"))); data/lilv-0.24.10/src/filesystem.c:169: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(rel + (i * 3), "../", 3); data/lilv-0.24.10/src/filesystem.c:173: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(rel + (up * 3), path + last_shared_sep + 1, suffix_len); data/lilv-0.24.10/src/filesystem.c:189: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(dirname, path, s - path + 1); data/lilv-0.24.10/src/filesystem.c:206: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(path, a, pre_len); data/lilv-0.24.10/src/filesystem.c:209: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(path + pre_len + 1, data/lilv-0.24.10/src/filesystem.c:254: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* in = fopen(src, "r"); data/lilv-0.24.10/src/filesystem.c:259: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). FILE* out = fopen(dst, "w"); data/lilv-0.24.10/src/filesystem.c:471: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). } else if (!(a_file = fopen(a_real, "rb")) || data/lilv-0.24.10/src/filesystem.c:472: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). !(b_file = fopen(b_real, "rb"))) { data/lilv-0.24.10/src/node.c:183: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 str[32]; data/lilv-0.24.10/src/node.c:195: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 str[32]; data/lilv-0.24.10/src/plugin.c:235:15: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE* fd = tmpfile(); data/lilv-0.24.10/src/state.c:133: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(pv->atom + 1, value, size); data/lilv-0.24.10/src/state.c:164: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(prop->value, value, size); data/lilv-0.24.10/src/state.c:351: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(ret, features, n_features * sizeof(LV2_Feature*)); data/lilv-0.24.10/src/state.c:656: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(prop.value, LV2_ATOM_BODY_CONST(atom), atom->size); data/lilv-0.24.10/src/state.c:867:21: [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* const wfd = fopen(path, "w"); data/lilv-0.24.10/src/state.c:897: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). FILE* rfd = fopen(manifest_path, "r"); data/lilv-0.24.10/src/state.c:1179: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* fd = fopen(path, "w"); data/lilv-0.24.10/src/state.c:1460: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(state->label, label, len + 1); data/lilv-0.24.10/src/util.c:48: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(result, first, len); data/lilv-0.24.10/src/util.c:67: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(result + len, s, this_len); data/lilv-0.24.10/src/util.c:86: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(copy, str, len + 1); data/lilv-0.24.10/src/util.c:146: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(dst + *dst_len, suffix, suffix_len); data/lilv-0.24.10/src/util.c:189:6: [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(var, s + 1, t - s - 1); data/lilv-0.24.10/src/util.c:223: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(path, in_path, in_path_len + 1); data/lilv-0.24.10/src/world.c:348: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 str[32]; data/lilv-0.24.10/src/world.c:610:14: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE* fd = tmpfile(); data/lilv-0.24.10/src/world.c:734:19: [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). version.minor = atoi((const char*)sord_node_get_string(minor_node)); data/lilv-0.24.10/src/world.c:735:19: [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). version.micro = atoi((const char*)sord_node_get_string(micro_node)); data/lilv-0.24.10/src/world.c:1005: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(dir, lv2_path, dir_len); data/lilv-0.24.10/test/lilv_test_utils.c:105:30: [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* const manifest_file = fopen(env->test_manifest_path, "w"); data/lilv-0.24.10/test/lilv_test_utils.c:110:28: [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* const plugin_file = fopen(env->test_content_path, "w"); data/lilv-0.24.10/test/test.lv2/test.c:27:13: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). # define mkstemp(pat) _mktemp(pat) data/lilv-0.24.10/test/test.lv2/test.c:53: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 tmp_file_path[sizeof(TMP_TEMPLATE)]; data/lilv-0.24.10/test/test.lv2/test.c:111:2: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). mkstemp(test->tmp_file_path); data/lilv-0.24.10/test/test.lv2/test.c:141:26: [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 (!(test->rec_file = fopen(test->rec_file_path, "w"))) { data/lilv-0.24.10/test/test.lv2/test.c:277: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* file = fopen(plugin->tmp_file_path, "w"); data/lilv-0.24.10/test/test.lv2/test.c:315:18: [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* sfile = fopen(spath, "w"); data/lilv-0.24.10/test/test.lv2/test.c:378:19: [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(path, "r"); data/lilv-0.24.10/test/test.lv2/test.c:379: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 str[8]; data/lilv-0.24.10/test/test.lv2/test.c:395: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* sfile = fopen(spath, "r"); data/lilv-0.24.10/test/test_filesystem.c:175:12: [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(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:227:12: [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(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:249:12: [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(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:269:12: [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(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:281:7: [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(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:304:19: [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* const f1 = fopen(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:305:19: [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* const f2 = fopen(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:343:19: [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* const f1 = fopen(path1, "w"); data/lilv-0.24.10/test/test_filesystem.c:344:19: [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* const f2 = fopen(path2, "w"); data/lilv-0.24.10/test/test_filesystem.c:403:26: [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* const f = fopen(file_path, "w"); data/lilv-0.24.10/test/test_filesystem.c:427:19: [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* const f1 = fopen(path1, "w"); data/lilv-0.24.10/test/test_filesystem.c:428:19: [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* const f2 = fopen(path2, "w"); data/lilv-0.24.10/test/test_util.c:29:13: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). # define mkstemp(pat) _mktemp(pat) data/lilv-0.24.10/test/test_util.c:42: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 a_path[16]; data/lilv-0.24.10/test/test_util.c:43: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 b_path[16]; data/lilv-0.24.10/test/test_util.c:46:2: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). mkstemp(a_path); data/lilv-0.24.10/test/test_util.c:47:2: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). mkstemp(b_path); data/lilv-0.24.10/test/test_util.c:49: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* fa = fopen(a_path, "w"); data/lilv-0.24.10/test/test_util.c:50: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* fb = fopen(b_path, "w"); data/lilv-0.24.10/utils/lv2bench.c:224:19: [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). sample_count = atoi(argv[++a]); data/lilv-0.24.10/utils/lv2bench.c:226: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). block_size = atoi(argv[++a]); data/lilv-0.24.10/utils/lv2info.c:416:21: [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* plugin_fd = fopen(plugin_file, "a"); data/lilv-0.24.10/utils/lv2info.c:425: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* manifest_fd = fopen(manifest_file, "a"); data/lilv-0.24.10/utils/uri_table.h:65: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(table->uris[table->n_uris - 1], uri, len + 1); data/lilv-0.24.10/src/filesystem.c:111: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). const size_t path_len = strlen(path); data/lilv-0.24.10/src/filesystem.c:112: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). const size_t dir_len = strlen(dir); data/lilv-0.24.10/src/filesystem.c:140:26: [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). const size_t path_len = strlen(path); data/lilv-0.24.10/src/filesystem.c:141:26: [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). const size_t base_len = strlen(base); data/lilv-0.24.10/src/filesystem.c:180: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). const char* s = path + strlen(path) - 1; // Last character data/lilv-0.24.10/src/filesystem.c:202: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). const size_t a_len = strlen(a); data/lilv-0.24.10/src/filesystem.c:203: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). const size_t b_len = b ? strlen(b) : 0; data/lilv-0.24.10/src/filesystem.c:370: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). const size_t pattern_len = strlen(pattern); data/lilv-0.24.10/src/filesystem.c:378: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). const size_t path_pattern_len = strlen(path_pattern); data/lilv-0.24.10/src/filesystem.c:407:26: [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). const size_t path_len = strlen(path); data/lilv-0.24.10/src/filesystem.c:478:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (fgetc(a_file) != fgetc(b_file)) { data/lilv-0.24.10/src/filesystem.c:478:25: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (fgetc(a_file) != fgetc(b_file)) { data/lilv-0.24.10/src/node.c:277: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). len = strlen(str) + 3; data/lilv-0.24.10/src/node.c:282: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). len = strlen(str) + 3; data/lilv-0.24.10/src/query.c:42:60: [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). const size_t a_lang_len = a_dash ? (size_t)(a_dash - a) : strlen(a); data/lilv-0.24.10/src/query.c:44:60: [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). const size_t b_lang_len = b_dash ? (size_t)(b_dash - b) : strlen(b); data/lilv-0.24.10/src/state.c:1009: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). strlen(abs_path) + 1, abs_path); data/lilv-0.24.10/src/state.c:1250: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). if (!strncmp(state_dir, path, strlen(state_dir))) { data/lilv-0.24.10/src/state.c:1458: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). const size_t len = strlen(label); data/lilv-0.24.10/src/util.c:45: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). size_t len = strlen(first); data/lilv-0.24.10/src/util.c:58: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). const size_t this_len = strlen(s); data/lilv-0.24.10/src/util.c:84:22: [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). const size_t len = strlen(str); data/lilv-0.24.10/src/util.c:114: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). const size_t env_lang_len = strlen(env_lang); data/lilv-0.24.10/src/util.c:158:39: [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 strappend(dst, dst_len, val, strlen(val)); data/lilv-0.24.10/src/util.c:161: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). dst_len, var, strlen(var)); data/lilv-0.24.10/src/util.c:209: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). out = strappend(out, &len, start, strlen(start)); data/lilv-0.24.10/src/util.c:221: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). const size_t in_path_len = strlen(in_path); data/lilv-0.24.10/src/world.c:917: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). strlen(lilv_node_as_string(bundle_uri)))) { data/lilv-0.24.10/src/world.c:1255: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). const size_t len = strlen(str); data/lilv-0.24.10/test/lilv_test_utils.c:116:35: [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). const size_t manifest_head_len = strlen(MANIFEST_PREFIXES); data/lilv-0.24.10/test/lilv_test_utils.c:117:35: [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). const size_t manifest_len = strlen(manifest); data/lilv-0.24.10/test/lilv_test_utils.c:118:35: [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). const size_t plugin_head_len = strlen(PLUGIN_PREFIXES); data/lilv-0.24.10/test/lilv_test_utils.c:119:35: [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). const size_t plugin_len = strlen(plugin); data/lilv-0.24.10/test/lilv_test_utils.c:176: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). const size_t len = strlen(name) + 1 + strlen(value) + 1; data/lilv-0.24.10/test/lilv_test_utils.c:176: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). const size_t len = strlen(name) + 1 + strlen(value) + 1; data/lilv-0.24.10/test/test.lv2/test.c:110:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(test->tmp_file_path, TMP_TEMPLATE, strlen(TMP_TEMPLATE) + 1); data/lilv-0.24.10/test/test.lv2/test.c:110:45: [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). strncpy(test->tmp_file_path, TMP_TEMPLATE, strlen(TMP_TEMPLATE) + 1); data/lilv-0.24.10/test/test.lv2/test.c:204:8: [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("hello") + 1, data/lilv-0.24.10/test/test.lv2/test.c:291: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). strlen(apath) + 1, data/lilv-0.24.10/test/test.lv2/test.c:306:10: [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(apath) + 1, data/lilv-0.24.10/test/test.lv2/test.c:323:10: [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(apath) + 1, data/lilv-0.24.10/test/test_state.c:287:26: [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("This is a comment") + 1, data/lilv-0.24.10/test/test_state.c:294:26: [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("LIVEBEEF") + 1, data/lilv-0.24.10/test/test_ui.c:152: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). strlen(lilv_node_as_string(plug_bundle_uri)) + strlen("ui" SHLIB_EXT); data/lilv-0.24.10/test/test_ui.c:152: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). strlen(lilv_node_as_string(plug_bundle_uri)) + strlen("ui" SHLIB_EXT); data/lilv-0.24.10/test/test_util.c:44:2: [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(a_path, "copy_a_XXXXXX", sizeof(a_path)); data/lilv-0.24.10/test/test_util.c:45:2: [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(b_path, "copy_b_XXXXXX", sizeof(b_path)); data/lilv-0.24.10/utils/uri_table.h:62: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). const size_t len = strlen(uri); ANALYSIS SUMMARY: Hits = 136 Lines analyzed = 16907 in approximately 0.45 seconds (37771 lines/second) Physical Source Lines of Code (SLOC) = 11356 Hits@level = [0] 143 [1] 48 [2] 66 [3] 8 [4] 14 [5] 0 Hits@level+ = [0+] 279 [1+] 136 [2+] 88 [3+] 22 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 24.5685 [1+] 11.976 [2+] 7.74921 [3+] 1.9373 [4+] 1.23283 [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.