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/libnbd-1.4.1/include/libnbd.h Examining data/libnbd-1.4.1/info/nbdinfo.c Examining data/libnbd-1.4.1/python/methods.c Examining data/libnbd-1.4.1/python/methods.h Examining data/libnbd-1.4.1/python/libnbdmod.c Examining data/libnbd-1.4.1/python/handle.c Examining data/libnbd-1.4.1/python/utils.c Examining data/libnbd-1.4.1/golang/src/libguestfs.org/libnbd/wrappers.h Examining data/libnbd-1.4.1/copy/nbdcopy.c Examining data/libnbd-1.4.1/tests/meta-base-allocation.c Examining data/libnbd-1.4.1/tests/compile.c Examining data/libnbd-1.4.1/tests/debug-environment.c Examining data/libnbd-1.4.1/tests/aio-parallel-load.c Examining data/libnbd-1.4.1/tests/compile-cxx.cpp Examining data/libnbd-1.4.1/tests/read-write-flag.c Examining data/libnbd-1.4.1/tests/server-death.c Examining data/libnbd-1.4.1/tests/eflags.c Examining data/libnbd-1.4.1/tests/compile-header-only.c Examining data/libnbd-1.4.1/tests/compile-ansi-c.c Examining data/libnbd-1.4.1/tests/read-only-flag.c Examining data/libnbd-1.4.1/tests/errors.c Examining data/libnbd-1.4.1/tests/opt-info.c Examining data/libnbd-1.4.1/tests/synch-parallel.c Examining data/libnbd-1.4.1/tests/get-size.c Examining data/libnbd-1.4.1/tests/newstyle-limited.c Examining data/libnbd-1.4.1/tests/debug.c Examining data/libnbd-1.4.1/tests/version.c Examining data/libnbd-1.4.1/tests/oldstyle.c Examining data/libnbd-1.4.1/tests/connect-unix.c Examining data/libnbd-1.4.1/tests/export-name.c Examining data/libnbd-1.4.1/tests/close-null.c Examining data/libnbd-1.4.1/tests/opt-list.c Examining data/libnbd-1.4.1/tests/closure-lifetimes.c Examining data/libnbd-1.4.1/tests/aio-parallel.c Examining data/libnbd-1.4.1/tests/connect-uri.c Examining data/libnbd-1.4.1/tests/opt-abort.c Examining data/libnbd-1.4.1/tests/connect-tcp.c Examining data/libnbd-1.4.1/tests/connect-tls.c Examining data/libnbd-1.4.1/ocaml/helpers.c Examining data/libnbd-1.4.1/ocaml/buffer.c Examining data/libnbd-1.4.1/ocaml/nbd-c.h Examining data/libnbd-1.4.1/ocaml/handle.c Examining data/libnbd-1.4.1/ocaml/nbd-c.c Examining data/libnbd-1.4.1/common/include/iszero.h Examining data/libnbd-1.4.1/common/include/byte-swapping.h Examining data/libnbd-1.4.1/fuzzing/libnbd-libfuzzer-test.c Examining data/libnbd-1.4.1/fuzzing/libnbd-fuzz-wrapper.c Examining data/libnbd-1.4.1/interop/socket-activation.c Examining data/libnbd-1.4.1/interop/interop.c Examining data/libnbd-1.4.1/interop/dirty-bitmap.c Examining data/libnbd-1.4.1/interop/structured-read.c Examining data/libnbd-1.4.1/interop/list-exports.c Examining data/libnbd-1.4.1/generator/states-connect-socket-activation.c Examining data/libnbd-1.4.1/generator/states-reply-simple.c Examining data/libnbd-1.4.1/generator/states-magic.c Examining data/libnbd-1.4.1/generator/states-reply.c Examining data/libnbd-1.4.1/generator/states-newstyle-opt-starttls.c Examining data/libnbd-1.4.1/generator/states-newstyle-opt-structured-reply.c Examining data/libnbd-1.4.1/generator/states-newstyle-opt-list.c Examining data/libnbd-1.4.1/generator/states-newstyle-opt-set-meta-context.c Examining data/libnbd-1.4.1/generator/states-issue-command.c Examining data/libnbd-1.4.1/generator/states-newstyle.c Examining data/libnbd-1.4.1/generator/states-connect.c Examining data/libnbd-1.4.1/generator/states-reply-structured.c Examining data/libnbd-1.4.1/generator/states-newstyle-opt-go.c Examining data/libnbd-1.4.1/generator/states.c Examining data/libnbd-1.4.1/generator/states-newstyle-opt-export-name.c Examining data/libnbd-1.4.1/generator/states-oldstyle.c Examining data/libnbd-1.4.1/lib/is-state.c Examining data/libnbd-1.4.1/lib/connect.c Examining data/libnbd-1.4.1/lib/protocol.c Examining data/libnbd-1.4.1/lib/states-run.c Examining data/libnbd-1.4.1/lib/socket.c Examining data/libnbd-1.4.1/lib/errors.c Examining data/libnbd-1.4.1/lib/opt.c Examining data/libnbd-1.4.1/lib/internal.h Examining data/libnbd-1.4.1/lib/debug.c Examining data/libnbd-1.4.1/lib/crypto.c Examining data/libnbd-1.4.1/lib/handle.c Examining data/libnbd-1.4.1/lib/states.c Examining data/libnbd-1.4.1/lib/rw.c Examining data/libnbd-1.4.1/lib/unlocked.h Examining data/libnbd-1.4.1/lib/nbd-protocol.h Examining data/libnbd-1.4.1/lib/utils.c Examining data/libnbd-1.4.1/lib/flags.c Examining data/libnbd-1.4.1/lib/states.h Examining data/libnbd-1.4.1/lib/aio.c Examining data/libnbd-1.4.1/lib/disconnect.c Examining data/libnbd-1.4.1/lib/api.c Examining data/libnbd-1.4.1/lib/poll.c Examining data/libnbd-1.4.1/lib/uri.c Examining data/libnbd-1.4.1/fuse/nbdfuse.c Examining data/libnbd-1.4.1/examples/glib-main-loop.c Examining data/libnbd-1.4.1/examples/aio-connect-read.c Examining data/libnbd-1.4.1/examples/encryption.c Examining data/libnbd-1.4.1/examples/strict-structured-reads.c Examining data/libnbd-1.4.1/examples/fetch-first-sector.c Examining data/libnbd-1.4.1/examples/connect-command.c Examining data/libnbd-1.4.1/examples/batched-read-write.c Examining data/libnbd-1.4.1/examples/reads-and-writes.c Examining data/libnbd-1.4.1/examples/open-qcow2.c Examining data/libnbd-1.4.1/examples/get-size.c Examining data/libnbd-1.4.1/examples/server-flags.c Examining data/libnbd-1.4.1/examples/list-exports.c Examining data/libnbd-1.4.1/examples/threaded-reads-and-writes.c FINAL RESULTS: data/libnbd-1.4.1/examples/aio-connect-read.c:40:8: [4] (shell) popen: 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. pp = popen ("hexdump -C", "w"); data/libnbd-1.4.1/examples/encryption.c:54:7: [4] (shell) system: 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. if (system (cmd) != 0) { data/libnbd-1.4.1/examples/fetch-first-sector.c:57:8: [4] (shell) popen: 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. pp = popen ("hexdump -C", "w"); data/libnbd-1.4.1/examples/open-qcow2.c:52:8: [4] (shell) popen: 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. fp = popen ("hexdump -C", "w"); data/libnbd-1.4.1/examples/server-flags.c:71:3: [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 (#flag_fn " = %s\n", \ data/libnbd-1.4.1/fuse/nbdfuse.c:393:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf (argv[optind], "%" SCNu32, &cid) != 1) { data/libnbd-1.4.1/fuse/nbdfuse.c:398:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf (argv[optind+1], "%" SCNu32, &port) != 1) { data/libnbd-1.4.1/generator/states-connect-socket-activation.c:198: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 (&env[0][PREFIX_LENGTH], v); data/libnbd-1.4.1/generator/states-connect-socket-activation.c:204:5: [4] (shell) execvp: 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. execvp (h->argv[0], h->argv); data/libnbd-1.4.1/generator/states-connect.c:240:5: [4] (shell) execvp: 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. execvp (h->argv[0], h->argv); data/libnbd-1.4.1/info/nbdinfo.c:574:8: [4] (shell) popen: 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. fp = popen (cmd, "r"); data/libnbd-1.4.1/lib/crypto.c:395:7: [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. if (access (cacert, R_OK) == -1) { data/libnbd-1.4.1/lib/crypto.c:429:7: [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. if (access (clientcert, R_OK) == 0 && access (clientkey, R_OK) == 0) { data/libnbd-1.4.1/lib/crypto.c:429:41: [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. if (access (clientcert, R_OK) == 0 && access (clientkey, R_OK) == 0) { data/libnbd-1.4.1/lib/crypto.c:439:7: [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. if (access (cacrl, R_OK) == 0) { data/libnbd-1.4.1/lib/states.c:1144:5: [4] (shell) execvp: 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. execvp (h->argv[0], h->argv); data/libnbd-1.4.1/lib/states.c:1304: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 (&env[0][PREFIX_LENGTH], v); data/libnbd-1.4.1/lib/states.c:1310:5: [4] (shell) execvp: 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. execvp (h->argv[0], h->argv); data/libnbd-1.4.1/lib/uri.c:312:11: [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 (uri->server, "%" SCNu32, &cid) != 1) { data/libnbd-1.4.1/tests/connect-tcp.c:56:5: [4] (shell) execlp: 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. execlp ("nbdkit", data/libnbd-1.4.1/tests/connect-tcp.c:65: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. if (access (PIDFILE, F_OK) == 0) data/libnbd-1.4.1/tests/connect-unix.c:54:5: [4] (shell) execlp: 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. execlp ("nbdkit", data/libnbd-1.4.1/tests/connect-unix.c:63: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. if (access (PIDFILE, F_OK) == 0) data/libnbd-1.4.1/tests/connect-uri.c:50:5: [4] (shell) execlp: 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. execlp ("nbdkit", data/libnbd-1.4.1/tests/connect-uri.c:60: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. if (access (PIDFILE, F_OK) == 0) data/libnbd-1.4.1/tests/eflags.c:52:7: [4] (shell) system: 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. if (system ("nbdkit --dump-plugin sh | grep -q " require)) { data/libnbd-1.4.1/tests/newstyle-limited.c:119:7: [4] (shell) system: 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. if (system ("nbdkit eval --dump-plugin | grep -q has_list_exports=1")) { data/libnbd-1.4.1/tests/opt-list.c:103:7: [4] (shell) system: 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. if (system ("nbdkit sh --dump-plugin | grep -q has_list_exports=1")) { data/libnbd-1.4.1/copy/nbdcopy.c:181: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. c = getopt_long (argc, argv, short_options, long_options, NULL); data/libnbd-1.4.1/examples/reads-and-writes.c:29:3: [3] (random) srand: 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. srand (time (NULL)); data/libnbd-1.4.1/examples/strict-structured-reads.c:178:3: [3] (random) srand: 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. srand (time (NULL)); data/libnbd-1.4.1/examples/threaded-reads-and-writes.c:76:3: [3] (random) srand: 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. srand (time (NULL)); data/libnbd-1.4.1/fuse/nbdfuse.c:182: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. c = getopt_long (argc, argv, short_options, long_options, NULL); data/libnbd-1.4.1/info/nbdinfo.c:111: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. c = getopt_long (argc, argv, short_options, long_options, NULL); data/libnbd-1.4.1/lib/crypto.c:130: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. s = getenv ("LOGNAME"); data/libnbd-1.4.1/lib/crypto.c:472:22: [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 *home = getenv ("HOME"); data/libnbd-1.4.1/lib/handle.c:75: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. s = getenv ("LIBNBD_DEBUG"); data/libnbd-1.4.1/tests/aio-parallel-load.c:114:3: [3] (random) srand: 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. srand (t + getpid ()); data/libnbd-1.4.1/tests/aio-parallel.c:100:3: [3] (random) srand: 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. srand (t + getpid ()); data/libnbd-1.4.1/tests/connect-tcp.c:45:3: [3] (random) srand: 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. srand (time (NULL) + getpid ()); data/libnbd-1.4.1/tests/eflags.c:59:13: [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. getenv ("srcdir") ? : "."); data/libnbd-1.4.1/tests/meta-base-allocation.c:48:13: [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. getenv ("srcdir") ? : "."); data/libnbd-1.4.1/tests/synch-parallel.c:93:3: [3] (random) srand: 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. srand (t + getpid ()); data/libnbd-1.4.1/copy/nbdcopy.c:104:10: [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). fd = open (filename, flags); data/libnbd-1.4.1/copy/nbdcopy.c:109:14: [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). fd = open (filename, flags, 0644); data/libnbd-1.4.1/copy/nbdcopy.c:287: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 buf[MAX_REQUEST_SIZE]; data/libnbd-1.4.1/copy/nbdcopy.c:369: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 msg[80]; data/libnbd-1.4.1/copy/nbdcopy.c:373:11: [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). tty = open ("/dev/tty", O_WRONLY); data/libnbd-1.4.1/examples/aio-connect-read.c:29: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 sector[SECTOR_SIZE]; data/libnbd-1.4.1/examples/connect-command.c:15: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 wbuf[512], rbuf[512]; data/libnbd-1.4.1/examples/encryption.c:51: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 (&cmd[i], dir, strlen (TMPDIR)); data/libnbd-1.4.1/examples/encryption.c:52: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 (keys, dir, strlen (TMPDIR)); data/libnbd-1.4.1/examples/encryption.c:66: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 buf[512]; data/libnbd-1.4.1/examples/fetch-first-sector.c:24: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 buf[512]; data/libnbd-1.4.1/examples/open-qcow2.c:16: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 buf[512]; data/libnbd-1.4.1/examples/reads-and-writes.c:24: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 buf[512]; data/libnbd-1.4.1/examples/strict-structured-reads.c:40: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 buf[MAX_BUF]; data/libnbd-1.4.1/fuse/nbdfuse.c:476:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen (pidfile, "w"); data/libnbd-1.4.1/fuzzing/libnbd-fuzz-wrapper.c:57:8: [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). fd = open (argv[1], O_RDONLY); data/libnbd-1.4.1/fuzzing/libnbd-fuzz-wrapper.c:112: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 buf[512]; data/libnbd-1.4.1/fuzzing/libnbd-fuzz-wrapper.c:141: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 rbuf[512], wbuf[512]; data/libnbd-1.4.1/fuzzing/libnbd-libfuzzer-test.c:102: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 buf[512]; data/libnbd-1.4.1/fuzzing/libnbd-libfuzzer-test.c:132: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 rbuf[512]; data/libnbd-1.4.1/generator/states-connect-socket-activation.c:144: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 (addr.sun_path, h->sa_sockpath, strlen (h->sa_sockpath) + 1); data/libnbd-1.4.1/generator/states-connect-socket-activation.c:195: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 buf[32]; data/libnbd-1.4.1/generator/states-connect-socket-activation.c:218: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 (&h->connaddr, &addr, h->connaddrlen); data/libnbd-1.4.1/generator/states.c:45: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 buf[BUFSIZ]; data/libnbd-1.4.1/info/nbdinfo.c:539: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 buf[8192]; data/libnbd-1.4.1/info/nbdinfo.c:552:8: [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 (template); data/libnbd-1.4.1/interop/interop.c:49:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). char tmpfile[] = "/tmp/nbdXXXXXX"; data/libnbd-1.4.1/interop/interop.c:53: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 buf[512]; data/libnbd-1.4.1/interop/interop.c:57:8: [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 (tmpfile); data/libnbd-1.4.1/interop/interop.c:57:17: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). fd = mkstemp (tmpfile); data/libnbd-1.4.1/interop/interop.c:61:13: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). perror (tmpfile); data/libnbd-1.4.1/interop/interop.c:180:11: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). unlink (tmpfile); data/libnbd-1.4.1/interop/list-exports.c:63:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). char tmpfile[] = "/tmp/nbdXXXXXX"; data/libnbd-1.4.1/interop/list-exports.c:70:8: [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 (tmpfile); data/libnbd-1.4.1/interop/list-exports.c:70:17: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). fd = mkstemp (tmpfile); data/libnbd-1.4.1/interop/list-exports.c:74:13: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). perror (tmpfile); data/libnbd-1.4.1/interop/list-exports.c:81:13: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). unlink (tmpfile); data/libnbd-1.4.1/interop/list-exports.c:99:13: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). unlink (tmpfile); data/libnbd-1.4.1/interop/list-exports.c:104:11: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). unlink (tmpfile); data/libnbd-1.4.1/interop/socket-activation.c:37:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). char tmpfile[] = "/tmp/nbdXXXXXX"; data/libnbd-1.4.1/interop/socket-activation.c:40: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 buf[512]; data/libnbd-1.4.1/interop/socket-activation.c:44:8: [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 (tmpfile); data/libnbd-1.4.1/interop/socket-activation.c:44:17: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). fd = mkstemp (tmpfile); data/libnbd-1.4.1/interop/socket-activation.c:48:13: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). perror (tmpfile); data/libnbd-1.4.1/interop/socket-activation.c:89:11: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). unlink (tmpfile); data/libnbd-1.4.1/interop/structured-read.c:38: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 rbuf[1024]; data/libnbd-1.4.1/lib/connect.c:142: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 (&h->connaddr, addr, len); data/libnbd-1.4.1/lib/connect.c:160: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 (sun.sun_path, unixsocket, namelen); data/libnbd-1.4.1/lib/connect.c:163: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 (&h->connaddr, &sun, len); data/libnbd-1.4.1/lib/connect.c:181: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 (&h->connaddr, &svm, len); data/libnbd-1.4.1/lib/crypto.c:284:8: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen (pskfile, "re"); data/libnbd-1.4.1/lib/internal.h:195:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str[NBD_MAX_STRING * 2 + 1]; /* name, description, NUL */ data/libnbd-1.4.1/lib/internal.h:201:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str[NBD_MAX_STRING]; data/libnbd-1.4.1/lib/internal.h:205:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str[NBD_MAX_STRING]; data/libnbd-1.4.1/lib/internal.h:207:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char err_msg[NBD_MAX_STRING]; data/libnbd-1.4.1/lib/internal.h:219:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char msg[NBD_MAX_STRING]; /* Common to all error types */ data/libnbd-1.4.1/lib/nbd-protocol.h:58: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 zeroes[124]; /* must be sent as zero bytes */ data/libnbd-1.4.1/lib/nbd-protocol.h:87: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 zeroes[124]; /* optional zeroes, unless NBD_FLAG_NO_ZEROES */ data/libnbd-1.4.1/lib/states.c:643: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 buf[BUFSIZ]; data/libnbd-1.4.1/lib/states.c:1250: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 (addr.sun_path, h->sa_sockpath, strlen (h->sa_sockpath) + 1); data/libnbd-1.4.1/lib/states.c:1301: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 buf[32]; data/libnbd-1.4.1/lib/states.c:1324: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 (&h->connaddr, &addr, h->connaddrlen); data/libnbd-1.4.1/lib/uri.c:159: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 port_str[32]; data/libnbd-1.4.1/lib/utils.c:40:46: [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. fprintf (fp, "%02x ", ((const unsigned char *)data)[j]); data/libnbd-1.4.1/lib/utils.c:45:28: [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. if (isprint (((const char *)data)[j])) data/libnbd-1.4.1/lib/utils.c:46:36: [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. fprintf (fp, "%c", ((const char *)data)[j]); data/libnbd-1.4.1/lib/utils.c:152: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 buf[32]; data/libnbd-1.4.1/ocaml/buffer.c:68: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 (Bytes_val (rv), b->data, b->len); data/libnbd-1.4.1/ocaml/buffer.c:85: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, Bytes_val (bytesv), b.len); data/libnbd-1.4.1/ocaml/nbd-c.h:51: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 *) String_val (sv), p, len); data/libnbd-1.4.1/python/handle.c:174: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 (buf->data, data, len); data/libnbd-1.4.1/tests/aio-parallel.c:112: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 (&ramdisk[i], &d, sizeof d); data/libnbd-1.4.1/tests/aio-parallel.c:188: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 buf[BUFFERSIZE]; data/libnbd-1.4.1/tests/aio-parallel.c:282:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (&ramdisk[offset], buf, BUFFERSIZE); data/libnbd-1.4.1/tests/closure-lifetimes.c:119: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 buf[512]; data/libnbd-1.4.1/tests/connect-tcp.c:38: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 port_str[16]; data/libnbd-1.4.1/tests/connect-tls.c:37: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 buf[512]; data/libnbd-1.4.1/tests/connect-unix.c:40: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). if (mkstemp (socket) == -1) { data/libnbd-1.4.1/tests/eflags.c:48: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 plugin_path[256]; data/libnbd-1.4.1/tests/eflags.c:49: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 key_param[32]; data/libnbd-1.4.1/tests/errors.c:37: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 buf[MAXSIZE]; data/libnbd-1.4.1/tests/errors.c:97:20: [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). if ((script_fd = mkstemp (script)) == -1) { data/libnbd-1.4.1/tests/errors.c:101:21: [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). if ((witness_fd = mkstemp (witness)) == -1) { data/libnbd-1.4.1/tests/meta-base-allocation.c:42: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 plugin_path[256]; data/libnbd-1.4.1/tests/newstyle-limited.c:36: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 wbuf[512] = { 1, 2, 3, 4 }, rbuf[512]; data/libnbd-1.4.1/tests/oldstyle.c:36: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 wbuf[512] = { 1, 2, 3, 4 }, rbuf[512]; data/libnbd-1.4.1/tests/server-death.c:53: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 buf[512]; data/libnbd-1.4.1/tests/synch-parallel.c:105: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 (&ramdisk[i], &d, sizeof d); data/libnbd-1.4.1/tests/synch-parallel.c:174: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 buf[16384]; data/libnbd-1.4.1/tests/synch-parallel.c:233:7: [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 (&ramdisk[offset], buf, sizeof buf); data/libnbd-1.4.1/copy/nbdcopy.c:296:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((r = read (fd, buf, sizeof buf)) > 0) { data/libnbd-1.4.1/copy/nbdcopy.c:391:24: [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 = write (tty, msg, strlen (msg)); data/libnbd-1.4.1/examples/encryption.c:50: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). i = strlen (cmd) - strlen (TMPDIR) - strlen (KEYS) - 1; data/libnbd-1.4.1/examples/encryption.c:50: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). i = strlen (cmd) - strlen (TMPDIR) - strlen (KEYS) - 1; data/libnbd-1.4.1/examples/encryption.c:50: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). i = strlen (cmd) - strlen (TMPDIR) - strlen (KEYS) - 1; data/libnbd-1.4.1/examples/encryption.c:51: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). memcpy (&cmd[i], dir, strlen (TMPDIR)); data/libnbd-1.4.1/examples/encryption.c:52: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). memcpy (keys, dir, strlen (TMPDIR)); data/libnbd-1.4.1/fuse/nbdfuse.c:263: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). if (strlen (p+1) == 0) goto mp_error; data/libnbd-1.4.1/fuzzing/libnbd-fuzz-wrapper.c:161:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read (sock, rbuf, sizeof rbuf); data/libnbd-1.4.1/fuzzing/libnbd-fuzz-wrapper.c:187:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read (fd, wbuf, sizeof wbuf); data/libnbd-1.4.1/fuzzing/libnbd-libfuzzer-test.c:154:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read (sock, rbuf, sizeof rbuf); data/libnbd-1.4.1/generator/states-connect-socket-activation.c:144: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). memcpy (addr.sun_path, h->sa_sockpath, strlen (h->sa_sockpath) + 1); data/libnbd-1.4.1/generator/states-newstyle-opt-export-name.c:25:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). h->sbuf.option.optlen = htobe32 (strlen (h->export_name)); data/libnbd-1.4.1/generator/states-newstyle-opt-export-name.c:37:15: [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). h->wlen = strlen (h->export_name); data/libnbd-1.4.1/generator/states-newstyle-opt-go.c:36:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). htobe32 (/* exportnamelen */ 4 + strlen (h->export_name) data/libnbd-1.4.1/generator/states-newstyle-opt-go.c:45: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 uint32_t exportnamelen = strlen (h->export_name); data/libnbd-1.4.1/generator/states-newstyle-opt-go.c:63:15: [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). h->wlen = strlen (h->export_name); data/libnbd-1.4.1/generator/states-newstyle-opt-set-meta-context.c:42: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). len = 4 /* exportname len */ + strlen (h->export_name) + 4 /* nr queries */; data/libnbd-1.4.1/generator/states-newstyle-opt-set-meta-context.c:45:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += 4 /* length of query */ + strlen (h->request_meta_contexts[i]); data/libnbd-1.4.1/generator/states-newstyle-opt-set-meta-context.c:60:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). h->sbuf.len = htobe32 (strlen (h->export_name)); data/libnbd-1.4.1/generator/states-newstyle-opt-set-meta-context.c:73:15: [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). h->wlen = strlen (h->export_name); data/libnbd-1.4.1/generator/states-newstyle-opt-set-meta-context.c:109: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). h->sbuf.len = htobe32 (strlen (query)); data/libnbd-1.4.1/generator/states-newstyle-opt-set-meta-context.c:123:15: [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). h->wlen = strlen (query); data/libnbd-1.4.1/lib/connect.c:155: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). namelen = strlen (unixsocket); data/libnbd-1.4.1/lib/crypto.c:279: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). const size_t ulen = strlen (username); data/libnbd-1.4.1/lib/crypto.c:605:48: [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). h->hostname, strlen (h->hostname)); data/libnbd-1.4.1/lib/states.c:1250: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). memcpy (addr.sun_path, h->sa_sockpath, strlen (h->sa_sockpath) + 1); data/libnbd-1.4.1/lib/states.c:2303: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). len = 4 /* exportname len */ + strlen (h->export_name) + 4 /* nr queries */; data/libnbd-1.4.1/lib/states.c:2306:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += 4 /* length of query */ + strlen (h->request_meta_contexts[i]); data/libnbd-1.4.1/lib/states.c:2346:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). h->sbuf.len = htobe32 (strlen (h->export_name)); data/libnbd-1.4.1/lib/states.c:2384:15: [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). h->wlen = strlen (h->export_name); data/libnbd-1.4.1/lib/states.c:2495: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). h->sbuf.len = htobe32 (strlen (query)); data/libnbd-1.4.1/lib/states.c:2534:15: [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). h->wlen = strlen (query); data/libnbd-1.4.1/lib/states.c:2792:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). htobe32 (/* exportnamelen */ 4 + strlen (h->export_name) data/libnbd-1.4.1/lib/states.c:2826: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 uint32_t exportnamelen = strlen (h->export_name); data/libnbd-1.4.1/lib/states.c:2869:15: [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). h->wlen = strlen (h->export_name); data/libnbd-1.4.1/lib/states.c:3260:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). h->sbuf.option.optlen = htobe32 (strlen (h->export_name)); data/libnbd-1.4.1/lib/states.c:3297:15: [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). h->wlen = strlen (h->export_name); data/libnbd-1.4.1/lib/uri.c:73: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). end = query + strlen (query); data/libnbd-1.4.1/lib/uri.c:214: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). if (strncmp (raw_uri + strlen (uri->scheme), "://", 3)) { data/libnbd-1.4.1/lib/utils.c:154: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). write (2, s, strlen (s)); data/libnbd-1.4.1/lib/utils.c:165: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). write (2, m, strlen (m)); data/libnbd-1.4.1/lib/utils.c:227: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 (str); data/libnbd-1.4.1/tests/errors.c:47: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). if (strncmp (msg, prefix, strlen (prefix)) != 0) { ANALYSIS SUMMARY: Hits = 177 Lines analyzed = 38790 in approximately 0.98 seconds (39472 lines/second) Physical Source Lines of Code (SLOC) = 29312 Hits@level = [0] 642 [1] 44 [2] 90 [3] 15 [4] 28 [5] 0 Hits@level+ = [0+] 819 [1+] 177 [2+] 133 [3+] 43 [4+] 28 [5+] 0 Hits/KSLOC@level+ = [0+] 27.9408 [1+] 6.03848 [2+] 4.53739 [3+] 1.46698 [4+] 0.95524 [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.