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/wayland-1.18.0/egl/wayland-egl-core.h Examining data/wayland-1.18.0/egl/wayland-egl-backend.h Examining data/wayland-1.18.0/egl/wayland-egl.h Examining data/wayland-1.18.0/egl/wayland-egl-abi-check.c Examining data/wayland-1.18.0/egl/wayland-egl.c Examining data/wayland-1.18.0/cursor/wayland-cursor.h Examining data/wayland-1.18.0/cursor/xcursor.c Examining data/wayland-1.18.0/cursor/cursor-data.h Examining data/wayland-1.18.0/cursor/os-compatibility.c Examining data/wayland-1.18.0/cursor/xcursor.h Examining data/wayland-1.18.0/cursor/os-compatibility.h Examining data/wayland-1.18.0/cursor/wayland-cursor.c Examining data/wayland-1.18.0/src/wayland-util.c Examining data/wayland-1.18.0/src/wayland-version.h Examining data/wayland-1.18.0/src/wayland-private.h Examining data/wayland-1.18.0/src/wayland-client.c Examining data/wayland-1.18.0/src/wayland-server-core.h Examining data/wayland-1.18.0/src/connection.c Examining data/wayland-1.18.0/src/scanner.c Examining data/wayland-1.18.0/src/wayland-client-core.h Examining data/wayland-1.18.0/src/wayland-server-private.h Examining data/wayland-1.18.0/src/wayland-client.h Examining data/wayland-1.18.0/src/wayland-shm.c Examining data/wayland-1.18.0/src/wayland-util.h Examining data/wayland-1.18.0/src/wayland-server.h Examining data/wayland-1.18.0/src/wayland-os.h Examining data/wayland-1.18.0/src/event-loop.c Examining data/wayland-1.18.0/src/wayland-os.c Examining data/wayland-1.18.0/src/wayland-server.c Examining data/wayland-1.18.0/tests/event-loop-test.c Examining data/wayland-1.18.0/tests/signal-test.c Examining data/wayland-1.18.0/tests/sanity-test.c Examining data/wayland-1.18.0/tests/resources-test.c Examining data/wayland-1.18.0/tests/display-test.c Examining data/wayland-1.18.0/tests/headers-protocol-test.c Examining data/wayland-1.18.0/tests/proxy-test.c Examining data/wayland-1.18.0/tests/exec-fd-leak-checker.c Examining data/wayland-1.18.0/tests/protocol-logger-test.c Examining data/wayland-1.18.0/tests/queue-test.c Examining data/wayland-1.18.0/tests/cpp-compile-test.cpp Examining data/wayland-1.18.0/tests/headers-test.c Examining data/wayland-1.18.0/tests/interface-test.c Examining data/wayland-1.18.0/tests/map-test.c Examining data/wayland-1.18.0/tests/data/example-client.h Examining data/wayland-1.18.0/tests/data/small-code-core.c Examining data/wayland-1.18.0/tests/data/small-client.h Examining data/wayland-1.18.0/tests/data/example-code.c Examining data/wayland-1.18.0/tests/data/example-server.h Examining data/wayland-1.18.0/tests/data/small-server-core.h Examining data/wayland-1.18.0/tests/data/small-server.h Examining data/wayland-1.18.0/tests/data/small-code.c Examining data/wayland-1.18.0/tests/data/small-client-core.h Examining data/wayland-1.18.0/tests/data/small-private-code.c Examining data/wayland-1.18.0/tests/fixed-test.c Examining data/wayland-1.18.0/tests/connection-test.c Examining data/wayland-1.18.0/tests/compositor-introspection-test.c Examining data/wayland-1.18.0/tests/test-compositor.c Examining data/wayland-1.18.0/tests/os-wrappers-test.c Examining data/wayland-1.18.0/tests/fixed-benchmark.c Examining data/wayland-1.18.0/tests/socket-test.c Examining data/wayland-1.18.0/tests/test-compositor.h Examining data/wayland-1.18.0/tests/client-test.c Examining data/wayland-1.18.0/tests/array-test.c Examining data/wayland-1.18.0/tests/test-runner.c Examining data/wayland-1.18.0/tests/message-test.c Examining data/wayland-1.18.0/tests/list-test.c Examining data/wayland-1.18.0/tests/test-helpers.c Examining data/wayland-1.18.0/tests/headers-protocol-core-test.c Examining data/wayland-1.18.0/tests/newsignal-test.c Examining data/wayland-1.18.0/tests/test-runner.h FINAL RESULTS: data/wayland-1.18.0/cursor/os-compatibility.c:147:3: [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(name, path); data/wayland-1.18.0/cursor/os-compatibility.c:148:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(name, template); data/wayland-1.18.0/cursor/xcursor.c:272: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 (new, name); data/wayland-1.18.0/src/scanner.c:328:2: [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(buf, sizeof buf, fmt, ap); data/wayland-1.18.0/src/scanner.c:389: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, msg, ap); data/wayland-1.18.0/src/scanner.c:403: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, msg, ap); data/wayland-1.18.0/src/wayland-server.c:286:2: [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(buffer, sizeof buffer, msg, argp); data/wayland-1.18.0/src/wayland-util.c:393: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, arg); data/wayland-1.18.0/tests/socket-test.c:129:9: [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. assert(access(path, F_OK) != -1); data/wayland-1.18.0/tests/socket-test.c:167: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. assert(access(path, F_OK) != -1); data/wayland-1.18.0/tests/socket-test.c:244:9: [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. assert(access(addr.sun_path, F_OK) == -1); data/wayland-1.18.0/tests/test-helpers.c:83:2: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl(exe_path, exe, number, (char *)NULL); data/wayland-1.18.0/cursor/os-compatibility.c:137: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. path = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/cursor/xcursor.c:630:9: [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. path = getenv ("XCURSOR_PATH"); data/wayland-1.18.0/cursor/xcursor.c:691:9: [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. home = getenv ("HOME"); data/wayland-1.18.0/src/scanner.c:1922:9: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. opt = getopt_long(argc, argv, "hvcs", options, NULL); data/wayland-1.18.0/src/wayland-client.c:967: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. name = getenv("WAYLAND_DISPLAY"); data/wayland-1.18.0/src/wayland-client.c:973:16: [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. runtime_dir = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/src/wayland-client.c:1042: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. debug = getenv("WAYLAND_DEBUG"); data/wayland-1.18.0/src/wayland-client.c:1134: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. connection = getenv("WAYLAND_SOCKET"); data/wayland-1.18.0/src/wayland-server.c:1048: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. debug = getenv("WAYLAND_DEBUG"); data/wayland-1.18.0/src/wayland-server.c:1486:16: [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. runtime_dir = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/src/wayland-server.c:1665: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. name = getenv("WAYLAND_DISPLAY"); data/wayland-1.18.0/tests/compositor-introspection-test.c:42: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. char *val = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/tests/fixed-test.c:47:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. f = random(); data/wayland-1.18.0/tests/protocol-logger-test.c:42: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. char *val = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/tests/socket-test.c:53: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. char *val = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/tests/test-compositor.c:185:7: [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("WAYLAND_SOCKET")) data/wayland-1.18.0/tests/test-helpers.c:73: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 *test_build_dir = getenv("TEST_BUILD_DIR"); data/wayland-1.18.0/tests/test-runner.c:174: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. xrd_env = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/tests/test-runner.c:196: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 *xrd_env = getenv("XDG_RUNTIME_DIR"); data/wayland-1.18.0/tests/test-runner.c:305: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. fd_leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK"); data/wayland-1.18.0/tests/test-runner.c:306:23: [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. timeouts_enabled = !getenv("WAYLAND_TEST_NO_TIMEOUTS"); data/wayland-1.18.0/cursor/os-compatibility.c:77:7: [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). fd = mkstemp(tmpname); data/wayland-1.18.0/cursor/wayland-cursor.c:243: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(theme->pool->data + image->offset, data/wayland-1.18.0/cursor/wayland-cursor.c:330: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(theme->pool->data + image->offset, data/wayland-1.18.0/cursor/xcursor.c:281:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char bytes[4]; data/wayland-1.18.0/cursor/xcursor.c:751: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 line[8192]; data/wayland-1.18.0/cursor/xcursor.c:758:9: [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 (full, "r"); data/wayland-1.18.0/cursor/xcursor.c:822: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 (full, "r"); data/wayland-1.18.0/cursor/xcursor.c:895: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(full, "r"); data/wayland-1.18.0/src/connection.c:58:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char data[4096]; data/wayland-1.18.0/src/connection.c:88: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(b->data + head, data, count); data/wayland-1.18.0/src/connection.c:91: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(b->data + head, data, size); data/wayland-1.18.0/src/connection.c:92: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(b->data, (const char *) data + size, count - size); data/wayland-1.18.0/src/connection.c:155: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(data, b->data + tail, count); data/wayland-1.18.0/src/connection.c:158: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(data, b->data + tail, size); data/wayland-1.18.0/src/connection.c:159: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((char *) data + size, b->data, count - size); data/wayland-1.18.0/src/connection.c:293: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 cmsg[CLEN]; data/wayland-1.18.0/src/connection.c:343: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 cmsg[CLEN]; data/wayland-1.18.0/src/connection.c:490: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). since = atoi(message->signature); data/wayland-1.18.0/src/connection.c:583: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(closure->args, args, count * sizeof *args); data/wayland-1.18.0/src/connection.c:1167: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(p, closure->args[i].s, size); data/wayland-1.18.0/src/connection.c:1182: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(p, closure->args[i].a->data, size); data/wayland-1.18.0/src/scanner.c:249: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 character_data[8192]; data/wayland-1.18.0/src/scanner.c:324: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[128], hang; data/wayland-1.18.0/src/scanner.c:1031: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(ctx->character_data + ctx->character_data_length, s, len); data/wayland-1.18.0/src/scanner.c:1972:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). input = fopen(input_filename, "r"); data/wayland-1.18.0/src/wayland-server.c:68: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 lock_addr[UNIX_PATH_MAX + LOCK_SUFFIXLEN]; data/wayland-1.18.0/src/wayland-server.c:284: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 buffer[128]; data/wayland-1.18.0/src/wayland-server.c:1439:20: [2] (misc) open: 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). socket->fd_lock = open(socket->lock_addr, O_CREAT | O_CLOEXEC | O_RDWR, data/wayland-1.18.0/src/wayland-server.c:1553: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 display_name[16] = ""; data/wayland-1.18.0/src/wayland-util.c:150: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(array->data, source->data, source->size); data/wayland-1.18.0/tests/connection-test.c:74: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 buffer[64]; data/wayland-1.18.0/tests/connection-test.c:92: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 buffer[64]; data/wayland-1.18.0/tests/connection-test.c:111: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 buffer[64]; data/wayland-1.18.0/tests/connection-test.c:434: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(&msg[3], data.value.s, msg[2]); data/wayland-1.18.0/tests/connection-test.c:441: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(&msg[3], data.value.s, msg[2]); data/wayland-1.18.0/tests/connection-test.c:515:17: [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). data.value.h = mkstemp(f); data/wayland-1.18.0/tests/connection-test.c:602: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 f[64]; data/wayland-1.18.0/tests/connection-test.c:611:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(f, "/tmp/wayland-tests-XXXXXX"); data/wayland-1.18.0/tests/connection-test.c:612:18: [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). data.value.h = mkstemp(f); data/wayland-1.18.0/tests/os-wrappers-test.c:317:20: [2] (misc) open: 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). data.value.h[2] = open("/dev/zero", O_RDONLY); data/wayland-1.18.0/tests/socket-test.c:61:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[TOO_LONG]; data/wayland-1.18.0/tests/socket-test.c:75:2: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(example_sockaddr_un.sun_path, "happy now clang?"); data/wayland-1.18.0/tests/socket-test.c:81: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 path[TOO_LONG]; data/wayland-1.18.0/tests/socket-test.c:102: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 path[sizeof example_sockaddr_un.sun_path]; data/wayland-1.18.0/tests/socket-test.c:145: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 path[sizeof example_sockaddr_un.sun_path]; data/wayland-1.18.0/tests/test-compositor.c:90: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 retval[64]; data/wayland-1.18.0/tests/test-compositor.c:162: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 s[8]; data/wayland-1.18.0/tests/test-helpers.c:72:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char number[16] = { 0 }; data/wayland-1.18.0/tests/test-helpers.c:74: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 exe_path[256] = { 0 }; data/wayland-1.18.0/tests/test-runner.c:171: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 xdg_runtime_dir[PATH_MAX]; data/wayland-1.18.0/cursor/os-compatibility.c:143: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). name = malloc(strlen(path) + sizeof(template)); data/wayland-1.18.0/cursor/xcursor.c:186:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int (*read) (XcursorFile *file, unsigned char *buf, int len); data/wayland-1.18.0/cursor/xcursor.c:267:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). new = malloc (strlen (name) + 1); data/wayland-1.18.0/cursor/xcursor.c:286:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((*file->read) (file, bytes, 4) != 4) data/wayland-1.18.0/cursor/xcursor.c:640: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). int pathlen = strlen (path); data/wayland-1.18.0/cursor/xcursor.c:645:2: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat (path, "/"); data/wayland-1.18.0/cursor/xcursor.c:649: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). len = strlen (elt); data/wayland-1.18.0/cursor/xcursor.c:656:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (path + pathlen, elt, len); data/wayland-1.18.0/cursor/xcursor.c:677: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). colon = dir + strlen (dir); data/wayland-1.18.0/cursor/xcursor.c:683: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). tcolon = theme + strlen (theme); data/wayland-1.18.0/cursor/xcursor.c:694: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). homelen = strlen (home); data/wayland-1.18.0/cursor/xcursor.c:725:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); data/wayland-1.18.0/cursor/xcursor.c:725: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). full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); data/wayland-1.18.0/cursor/xcursor.c:725:61: [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). full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); data/wayland-1.18.0/cursor/xcursor.c:771:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). result = malloc (strlen (l) + 1); data/wayland-1.18.0/src/connection.c:1092: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). size = strlen(closure->args[i].s) + 1; data/wayland-1.18.0/src/connection.c:1161: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). size = strlen(closure->args[i].s) + 1; data/wayland-1.18.0/src/event-loop.c:680:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(source->fd, &signal_info, sizeof signal_info); data/wayland-1.18.0/src/scanner.c:346: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). col += strlen(&buf[i]); data/wayland-1.18.0/src/scanner.c:916: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). for (j = 0; j + 1 < strlen(enum_attribute); j++) { data/wayland-1.18.0/src/scanner.c:982:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(r, s, size); data/wayland-1.18.0/src/scanner.c:1041: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). length = strlen(text); data/wayland-1.18.0/src/scanner.c:1443: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). n = strlen(m->name) + 17; data/wayland-1.18.0/src/scanner.c:1489:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). indent(14 + strlen(interface->name)), data/wayland-1.18.0/src/wayland-server.c:1500:57: [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). s->display_name = (s->addr.sun_path + name_size - 1) - strlen(name); data/wayland-1.18.0/src/wayland-server.c:1526:51: [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 = offsetof (struct sockaddr_un, sun_path) + strlen(s->addr.sun_path); data/wayland-1.18.0/tests/connection-test.c:80:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(s[1], buffer, sizeof buffer) == sizeof message); data/wayland-1.18.0/tests/connection-test.c:124:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(s[1], buffer, sizeof buffer) == 2 * sizeof message); data/wayland-1.18.0/tests/connection-test.c:216:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(data->s[0], data->buffer, sizeof data->buffer) == size); data/wayland-1.18.0/tests/display-test.c:1282:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). count = read(fd, &buf, 1); data/wayland-1.18.0/tests/display-test.c:1490:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(rpipe[0], &tmp, sizeof(tmp)); data/wayland-1.18.0/tests/event-loop-test.c:326:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(MSEC_TO_USEC(15)); data/wayland-1.18.0/tests/event-loop-test.c:397:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(MSEC_TO_USEC(21)); data/wayland-1.18.0/tests/event-loop-test.c:464:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(MSEC_TO_USEC(2)); data/wayland-1.18.0/tests/socket-test.c:246:51: [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 = offsetof (struct sockaddr_un, sun_path) + strlen(addr.sun_path); data/wayland-1.18.0/tests/test-compositor.c:167:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(client_pipe, &can_continue, sizeof(int)) == sizeof(int)); data/wayland-1.18.0/tests/test-runner.c:254:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(pipefd[0], &buf, 1); ANALYSIS SUMMARY: Hits = 120 Lines analyzed = 34576 in approximately 0.87 seconds (39940 lines/second) Physical Source Lines of Code (SLOC) = 18226 Hits@level = [0] 262 [1] 37 [2] 50 [3] 21 [4] 12 [5] 0 Hits@level+ = [0+] 382 [1+] 120 [2+] 83 [3+] 33 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 20.9591 [1+] 6.584 [2+] 4.55393 [3+] 1.8106 [4+] 0.6584 [5+] 0 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.