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/btrfs-progs-5.9/androidcompat.h Examining data/btrfs-progs-5.9/btrfs-corrupt-block.c Examining data/btrfs-progs-5.9/btrfs-crc.c Examining data/btrfs-progs-5.9/btrfs-find-root.c Examining data/btrfs-progs-5.9/btrfs-fragments.c Examining data/btrfs-progs-5.9/btrfs-list.c Examining data/btrfs-progs-5.9/btrfs-list.h Examining data/btrfs-progs-5.9/btrfs-map-logical.c Examining data/btrfs-progs-5.9/btrfs-sb-mod.c Examining data/btrfs-progs-5.9/btrfs-select-super.c Examining data/btrfs-progs-5.9/btrfs.c Examining data/btrfs-progs-5.9/btrfsck.h Examining data/btrfs-progs-5.9/btrfstune.c Examining data/btrfs-progs-5.9/check/common.h Examining data/btrfs-progs-5.9/check/main.c Examining data/btrfs-progs-5.9/check/mode-common.c Examining data/btrfs-progs-5.9/check/mode-common.h Examining data/btrfs-progs-5.9/check/mode-lowmem.c Examining data/btrfs-progs-5.9/check/mode-lowmem.h Examining data/btrfs-progs-5.9/check/mode-original.h Examining data/btrfs-progs-5.9/check/qgroup-verify.c Examining data/btrfs-progs-5.9/check/qgroup-verify.h Examining data/btrfs-progs-5.9/cmds/balance.c Examining data/btrfs-progs-5.9/cmds/commands.h Examining data/btrfs-progs-5.9/cmds/device.c Examining data/btrfs-progs-5.9/cmds/filesystem-du.c Examining data/btrfs-progs-5.9/cmds/filesystem-usage.c Examining data/btrfs-progs-5.9/cmds/filesystem-usage.h Examining data/btrfs-progs-5.9/cmds/filesystem.c Examining data/btrfs-progs-5.9/cmds/inspect-dump-super.c Examining data/btrfs-progs-5.9/cmds/inspect-dump-tree.c Examining data/btrfs-progs-5.9/cmds/inspect-tree-stats.c Examining data/btrfs-progs-5.9/cmds/inspect.c Examining data/btrfs-progs-5.9/cmds/property.c Examining data/btrfs-progs-5.9/cmds/qgroup.c Examining data/btrfs-progs-5.9/cmds/quota.c Examining data/btrfs-progs-5.9/cmds/receive-dump.c Examining data/btrfs-progs-5.9/cmds/receive-dump.h Examining data/btrfs-progs-5.9/cmds/receive.c Examining data/btrfs-progs-5.9/cmds/replace.c Examining data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c Examining data/btrfs-progs-5.9/cmds/rescue-super-recover.c Examining data/btrfs-progs-5.9/cmds/rescue.c Examining data/btrfs-progs-5.9/cmds/rescue.h Examining data/btrfs-progs-5.9/cmds/restore.c Examining data/btrfs-progs-5.9/cmds/scrub.c Examining data/btrfs-progs-5.9/cmds/send.c Examining data/btrfs-progs-5.9/cmds/subvolume.c Examining data/btrfs-progs-5.9/common/box.h Examining data/btrfs-progs-5.9/common/defs.h Examining data/btrfs-progs-5.9/common/device-scan.c Examining data/btrfs-progs-5.9/common/device-scan.h Examining data/btrfs-progs-5.9/common/device-utils.c Examining data/btrfs-progs-5.9/common/device-utils.h Examining data/btrfs-progs-5.9/common/extent-cache.c Examining data/btrfs-progs-5.9/common/extent-cache.h Examining data/btrfs-progs-5.9/common/format-output.c Examining data/btrfs-progs-5.9/common/format-output.h Examining data/btrfs-progs-5.9/common/fsfeatures.c Examining data/btrfs-progs-5.9/common/fsfeatures.h Examining data/btrfs-progs-5.9/common/help.c Examining data/btrfs-progs-5.9/common/help.h Examining data/btrfs-progs-5.9/common/internal.h Examining data/btrfs-progs-5.9/common/messages.c Examining data/btrfs-progs-5.9/common/messages.h Examining data/btrfs-progs-5.9/common/path-utils.c Examining data/btrfs-progs-5.9/common/path-utils.h Examining data/btrfs-progs-5.9/common/rbtree-utils.c Examining data/btrfs-progs-5.9/common/rbtree-utils.h Examining data/btrfs-progs-5.9/common/send-stream.c Examining data/btrfs-progs-5.9/common/send-stream.h Examining data/btrfs-progs-5.9/common/send-utils.c Examining data/btrfs-progs-5.9/common/send-utils.h Examining data/btrfs-progs-5.9/common/string-table.c Examining data/btrfs-progs-5.9/common/string-table.h Examining data/btrfs-progs-5.9/common/task-utils.c Examining data/btrfs-progs-5.9/common/task-utils.h Examining data/btrfs-progs-5.9/common/utils-lib.c Examining data/btrfs-progs-5.9/common/utils.c Examining data/btrfs-progs-5.9/common/utils.h Examining data/btrfs-progs-5.9/convert/common.c Examining data/btrfs-progs-5.9/convert/common.h Examining data/btrfs-progs-5.9/convert/main.c Examining data/btrfs-progs-5.9/convert/source-ext2.c Examining data/btrfs-progs-5.9/convert/source-ext2.h Examining data/btrfs-progs-5.9/convert/source-fs.c Examining data/btrfs-progs-5.9/convert/source-fs.h Examining data/btrfs-progs-5.9/convert/source-reiserfs.c Examining data/btrfs-progs-5.9/convert/source-reiserfs.h Examining data/btrfs-progs-5.9/crypto/blake2-impl.h Examining data/btrfs-progs-5.9/crypto/blake2.h Examining data/btrfs-progs-5.9/crypto/blake2b-ref.c Examining data/btrfs-progs-5.9/crypto/crc32c.c Examining data/btrfs-progs-5.9/crypto/crc32c.h Examining data/btrfs-progs-5.9/crypto/hash-speedtest.c Examining data/btrfs-progs-5.9/crypto/hash.c Examining data/btrfs-progs-5.9/crypto/hash.h Examining data/btrfs-progs-5.9/crypto/sha-private.h Examining data/btrfs-progs-5.9/crypto/sha.h Examining data/btrfs-progs-5.9/crypto/sha224-256.c Examining data/btrfs-progs-5.9/crypto/xxhash.c Examining data/btrfs-progs-5.9/crypto/xxhash.h Examining data/btrfs-progs-5.9/image/main.c Examining data/btrfs-progs-5.9/image/metadump.h Examining data/btrfs-progs-5.9/image/sanitize.c Examining data/btrfs-progs-5.9/image/sanitize.h Examining data/btrfs-progs-5.9/ioctl.h Examining data/btrfs-progs-5.9/kerncompat.h Examining data/btrfs-progs-5.9/kernel-lib/bitops.h Examining data/btrfs-progs-5.9/kernel-lib/interval_tree_generic.h Examining data/btrfs-progs-5.9/kernel-lib/list.h Examining data/btrfs-progs-5.9/kernel-lib/list_sort.c Examining data/btrfs-progs-5.9/kernel-lib/list_sort.h Examining data/btrfs-progs-5.9/kernel-lib/mktables.c Examining data/btrfs-progs-5.9/kernel-lib/overflow.h Examining data/btrfs-progs-5.9/kernel-lib/radix-tree.c Examining data/btrfs-progs-5.9/kernel-lib/radix-tree.h Examining data/btrfs-progs-5.9/kernel-lib/raid56.c Examining data/btrfs-progs-5.9/kernel-lib/raid56.h Examining data/btrfs-progs-5.9/kernel-lib/rbtree.c Examining data/btrfs-progs-5.9/kernel-lib/rbtree.h Examining data/btrfs-progs-5.9/kernel-lib/rbtree_augmented.h Examining data/btrfs-progs-5.9/kernel-lib/sizes.h Examining data/btrfs-progs-5.9/kernel-lib/tables.c Examining data/btrfs-progs-5.9/kernel-shared/backref.c Examining data/btrfs-progs-5.9/kernel-shared/backref.h Examining data/btrfs-progs-5.9/kernel-shared/ctree.c Examining data/btrfs-progs-5.9/kernel-shared/ctree.h Examining data/btrfs-progs-5.9/kernel-shared/delayed-ref.c Examining data/btrfs-progs-5.9/kernel-shared/delayed-ref.h Examining data/btrfs-progs-5.9/kernel-shared/dir-item.c Examining data/btrfs-progs-5.9/kernel-shared/disk-io.c Examining data/btrfs-progs-5.9/kernel-shared/disk-io.h Examining data/btrfs-progs-5.9/kernel-shared/extent-tree.c Examining data/btrfs-progs-5.9/kernel-shared/extent_io.c Examining data/btrfs-progs-5.9/kernel-shared/extent_io.h Examining data/btrfs-progs-5.9/kernel-shared/file-item.c Examining data/btrfs-progs-5.9/kernel-shared/file.c Examining data/btrfs-progs-5.9/kernel-shared/free-space-cache.c Examining data/btrfs-progs-5.9/kernel-shared/free-space-cache.h Examining data/btrfs-progs-5.9/kernel-shared/free-space-tree.c Examining data/btrfs-progs-5.9/kernel-shared/free-space-tree.h Examining data/btrfs-progs-5.9/kernel-shared/inode-item.c Examining data/btrfs-progs-5.9/kernel-shared/inode.c Examining data/btrfs-progs-5.9/kernel-shared/print-tree.c Examining data/btrfs-progs-5.9/kernel-shared/print-tree.h Examining data/btrfs-progs-5.9/kernel-shared/root-tree.c Examining data/btrfs-progs-5.9/kernel-shared/transaction.c Examining data/btrfs-progs-5.9/kernel-shared/transaction.h Examining data/btrfs-progs-5.9/kernel-shared/ulist.c Examining data/btrfs-progs-5.9/kernel-shared/ulist.h Examining data/btrfs-progs-5.9/kernel-shared/uuid-tree.c Examining data/btrfs-progs-5.9/kernel-shared/volumes.c Examining data/btrfs-progs-5.9/kernel-shared/volumes.h Examining data/btrfs-progs-5.9/libbtrfsutil/btrfs.h Examining data/btrfs-progs-5.9/libbtrfsutil/btrfs_tree.h Examining data/btrfs-progs-5.9/libbtrfsutil/btrfsutil.h Examining data/btrfs-progs-5.9/libbtrfsutil/btrfsutil_internal.h Examining data/btrfs-progs-5.9/libbtrfsutil/errors.c Examining data/btrfs-progs-5.9/libbtrfsutil/filesystem.c Examining data/btrfs-progs-5.9/libbtrfsutil/python/btrfsutilpy.h Examining data/btrfs-progs-5.9/libbtrfsutil/python/error.c Examining data/btrfs-progs-5.9/libbtrfsutil/python/filesystem.c Examining data/btrfs-progs-5.9/libbtrfsutil/python/module.c Examining data/btrfs-progs-5.9/libbtrfsutil/python/qgroup.c Examining data/btrfs-progs-5.9/libbtrfsutil/python/subvolume.c Examining data/btrfs-progs-5.9/libbtrfsutil/qgroup.c Examining data/btrfs-progs-5.9/libbtrfsutil/stubs.c Examining data/btrfs-progs-5.9/libbtrfsutil/stubs.h Examining data/btrfs-progs-5.9/libbtrfsutil/subvolume.c Examining data/btrfs-progs-5.9/mkfs/common.c Examining data/btrfs-progs-5.9/mkfs/common.h Examining data/btrfs-progs-5.9/mkfs/main.c Examining data/btrfs-progs-5.9/mkfs/rootdir.c Examining data/btrfs-progs-5.9/mkfs/rootdir.h Examining data/btrfs-progs-5.9/props.c Examining data/btrfs-progs-5.9/props.h Examining data/btrfs-progs-5.9/qgroup.c Examining data/btrfs-progs-5.9/qgroup.h Examining data/btrfs-progs-5.9/quick-test.c Examining data/btrfs-progs-5.9/random-test.c Examining data/btrfs-progs-5.9/repair.c Examining data/btrfs-progs-5.9/repair.h Examining data/btrfs-progs-5.9/send.h Examining data/btrfs-progs-5.9/tests/fssum.c Examining data/btrfs-progs-5.9/tests/ioctl-test.c Examining data/btrfs-progs-5.9/tests/library-test.c FINAL RESULTS: data/btrfs-progs-5.9/cmds/receive.c:931:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = chmod(full_path, mode); data/btrfs-progs-5.9/common/send-stream.c:433:20: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = sctx->ops->chmod(path, tmp, sctx->user); data/btrfs-progs-5.9/common/send-stream.c:439:20: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. ret = sctx->ops->chown(path, tmp, tmp2, sctx->user); data/btrfs-progs-5.9/common/send-stream.h:63:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. int (*chmod)(const char *path, u64 mode, void *user); data/btrfs-progs-5.9/common/send-stream.h:64:8: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. int (*chown)(const char *path, u64 uid, u64 gid, void *user); data/btrfs-progs-5.9/mkfs/rootdir.c:281:8: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ret = readlink(path_name, buf, sizeof(buf)); data/btrfs-progs-5.9/tests/fssum.c:595:10: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ret = readlink(namelist[i], buf, sizeof(buf)); data/btrfs-progs-5.9/btrfs-list.c:673: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(ri->path, args.name); data/btrfs-progs-5.9/btrfs-list.c:674: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(ri->path, ri->name); data/btrfs-progs-5.9/btrfs-list.c:830:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(full, dirid); data/btrfs-progs-5.9/btrfs-list.c:831:2: [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(full, name); data/btrfs-progs-5.9/cmds/filesystem-du.c:454:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. ret = sprintf(pathp, "%s", filename); data/btrfs-progs-5.9/cmds/filesystem-du.c:456:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. ret = sprintf(pathp, "/%s", filename); data/btrfs-progs-5.9/cmds/filesystem-usage.c:702:4: [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(info[ndevs].path, (char *)dev_info.path); data/btrfs-progs-5.9/cmds/property.c:87:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(tmp, object); data/btrfs-progs-5.9/cmds/receive-dump.c:94:25: [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. __attribute__ ((format (printf, 5, 6))) data/btrfs-progs-5.9/cmds/receive-dump.c:125:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/btrfs-progs-5.9/cmds/scrub.c:699:29: [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. __attribute__ ((format (printf, 4, 5))); data/btrfs-progs-5.9/cmds/scrub.c:706:8: [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. ret = vsnprintf(buf, max, fmt, args); data/btrfs-progs-5.9/cmds/subvolume.c:328:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(full_subvolpath, "%s/%s", path, subvol); data/btrfs-progs-5.9/common/format-output.c:269:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(row->fmt, args); data/btrfs-progs-5.9/common/fsfeatures.c:174:4: [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(buf, feat->name); data/btrfs-progs-5.9/common/messages.c:22:25: [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. __attribute__ ((format (printf, 1, 2))) data/btrfs-progs-5.9/common/messages.c:29:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/btrfs-progs-5.9/common/messages.c:34:25: [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. __attribute__ ((format (printf, 1, 2))) data/btrfs-progs-5.9/common/messages.c:41:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/btrfs-progs-5.9/common/messages.c:46:25: [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. __attribute__ ((format (printf, 2, 3))) data/btrfs-progs-5.9/common/messages.c:56:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/btrfs-progs-5.9/common/messages.c:63:25: [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. __attribute__ ((format (printf, 2, 3))) data/btrfs-progs-5.9/common/messages.c:73:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/btrfs-progs-5.9/common/messages.c:85:25: [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. __attribute__ ((format (printf, 2, 3))) data/btrfs-progs-5.9/common/messages.c:97: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(stdout, fmt, args); data/btrfs-progs-5.9/common/messages.h:86:25: [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. __attribute__ ((format (printf, 1, 2))) data/btrfs-progs-5.9/common/messages.h:89:25: [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. __attribute__ ((format (printf, 1, 2))) data/btrfs-progs-5.9/common/messages.h:92:25: [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. __attribute__ ((format (printf, 2, 3))) data/btrfs-progs-5.9/common/messages.h:95:25: [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. __attribute__ ((format (printf, 2, 3))) data/btrfs-progs-5.9/common/messages.h:105:25: [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. __attribute__ ((format (printf, 2, 3))) data/btrfs-progs-5.9/common/path-utils.c:167:8: [4] (buffer) fscanf: 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. ret = fscanf(f, fmt, loop_file); data/btrfs-progs-5.9/common/path-utils.c:303: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(path, F_OK) == 0) data/btrfs-progs-5.9/common/send-utils.c:326: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(path, ino_lookup_arg.name); data/btrfs-progs-5.9/common/string-table.c:51:25: [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. __attribute__ ((format (printf, 4, 0))) data/btrfs-progs-5.9/common/string-table.c:64: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(msg, 99, fmt, ap); data/btrfs-progs-5.9/common/string-table.c:73:25: [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. __attribute__ ((format (printf, 4, 5))) data/btrfs-progs-5.9/common/utils.c:1757: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(ptr, btrfs_raid_array[BTRFS_RAID_SINGLE].raid_name); data/btrfs-progs-5.9/common/utils.c:1765: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(ptr, btrfs_raid_array[i].raid_name); data/btrfs-progs-5.9/common/utils.c:1849:26: [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. char *data, *metadata, *system, *mixed, *types; data/btrfs-progs-5.9/common/utils.c:1852:5: [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. &system, &types); data/btrfs-progs-5.9/common/utils.c:1856: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. free(system); data/btrfs-progs-5.9/convert/main.c:1277: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(root->fs_info->super_copy->label, fslabel); data/btrfs-progs-5.9/kerncompat.h:297:30: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define printk(fmt, args...) fprintf(stderr, fmt, ##args) data/btrfs-progs-5.9/kernel-shared/print-tree.c:897: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(dst, #name); \ data/btrfs-progs-5.9/mkfs/main.c:60:6: [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. u64 system; data/btrfs-progs-5.9/mkfs/main.c:1531:27: [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. pretty_size(allocation.system)); data/btrfs-progs-5.9/tests/fssum.c:521:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s", path_in, namelist[i]); data/btrfs-progs-5.9/tests/fssum.c:758:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(flagstring, flchar); data/btrfs-progs-5.9/btrfs-corrupt-block.c:1184:7: [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, "l:c:b:eEkuUi:f:x:m:K:I:D:d:r:C:", data/btrfs-progs-5.9/btrfs-crc.c:49:14: [3] (buffer) getopt: 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. while ((c = getopt(argc, argv, "l:c:s:h")) != -1) { data/btrfs-progs-5.9/btrfs-find-root.c:354:11: [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. int c = getopt_long(argc, argv, "al:o:g:", long_options, NULL); data/btrfs-progs-5.9/btrfs-fragments.c:418:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "cmso:h"); data/btrfs-progs-5.9/btrfs-map-logical.c:233:7: [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, "l:c:o:b:", long_options, NULL); data/btrfs-progs-5.9/btrfs-select-super.c:50:7: [3] (buffer) getopt: 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(argc, argv, "s:"); data/btrfs-progs-5.9/btrfs.c:264:7: [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, "+vq", long_options, NULL); data/btrfs-progs-5.9/btrfstune.c:504:11: [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. int c = getopt_long(argc, argv, "S:rxfuU:nmM:", long_options, NULL); data/btrfs-progs-5.9/check/main.c:10003:7: [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, "as:br:pE:Q", long_options, NULL); data/btrfs-progs-5.9/cmds/balance.c:540:13: [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. int opt = getopt_long(argc, argv, "d::s::m::fv", longopts, NULL); data/btrfs-progs-5.9/cmds/balance.c:866: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, "v", longopts, NULL); data/btrfs-progs-5.9/cmds/device.c:74:7: [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, "Kf", long_options, NULL); data/btrfs-progs-5.9/cmds/device.c:331:7: [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, "du", long_options, NULL); data/btrfs-progs-5.9/cmds/device.c:495:7: [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, "cz", long_options, NULL); data/btrfs-progs-5.9/cmds/filesystem-du.c:577:11: [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. int c = getopt_long(argc, argv, "s", long_options, NULL); data/btrfs-progs-5.9/cmds/filesystem-usage.c:1094:7: [3] (buffer) getopt: 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(argc, argv, "T"); data/btrfs-progs-5.9/cmds/filesystem.c:667:7: [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, "dm", long_options, NULL); data/btrfs-progs-5.9/cmds/filesystem.c:699:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(search, path)) data/btrfs-progs-5.9/cmds/filesystem.c:921:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "vrc::fs:l:t:"); data/btrfs-progs-5.9/cmds/inspect-dump-super.c:107:7: [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, "fFai:s:", long_options, NULL); data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:351:7: [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, "deb:rRut:", long_options, NULL); data/btrfs-progs-5.9/cmds/inspect-tree-stats.c:454:16: [3] (buffer) getopt: 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. while ((opt = getopt(argc, argv, "vb")) != -1) { data/btrfs-progs-5.9/cmds/inspect.c:100:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "v"); data/btrfs-progs-5.9/cmds/inspect.c:163:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "Pvos:"); data/btrfs-progs-5.9/cmds/inspect.c:629:7: [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, "", long_options, NULL); data/btrfs-progs-5.9/cmds/property.c:72:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. rp = realpath(object, NULL); data/btrfs-progs-5.9/cmds/property.c:266:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "t:"); data/btrfs-progs-5.9/cmds/qgroup.c:58:7: [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, "", long_options, NULL); data/btrfs-progs-5.9/cmds/qgroup.c:277:7: [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, "pcreFf", long_options, NULL); data/btrfs-progs-5.9/cmds/qgroup.c:393:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "ce"); data/btrfs-progs-5.9/cmds/quota.c:129:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "sw"); data/btrfs-progs-5.9/cmds/receive.c:1065:23: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. dest_dir_full_path = realpath(tomnt, NULL); data/btrfs-progs-5.9/cmds/receive.c:1129:7: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(dest_dir_full_path)) { data/btrfs-progs-5.9/cmds/receive.c:1297:7: [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, "Cevqf:m:E:", long_opts, NULL); data/btrfs-progs-5.9/cmds/replace.c:141:14: [3] (buffer) getopt: 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. while ((c = getopt(argc, argv, "Brf")) != -1) { data/btrfs-progs-5.9/cmds/replace.c:346:14: [3] (buffer) getopt: 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. while ((c = getopt(argc, argv, "1")) != -1) { data/btrfs-progs-5.9/cmds/replace.c:516:14: [3] (buffer) getopt: 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. while ((c = getopt(argc, argv, "")) != -1) { data/btrfs-progs-5.9/cmds/rescue.c:61:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "yvh"); data/btrfs-progs-5.9/cmds/rescue.c:132:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "vy"); data/btrfs-progs-5.9/cmds/restore.c:1448: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, "sSxviot:u:dmf:r:lDc", long_options, data/btrfs-progs-5.9/cmds/scrub.c:1176:14: [3] (buffer) getopt: 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. while ((c = getopt(argc, argv, "BdqrRc:n:f")) != -1) { data/btrfs-progs-5.9/cmds/scrub.c:1731:14: [3] (buffer) getopt: 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. while ((c = getopt(argc, argv, "dR")) != -1) { data/btrfs-progs-5.9/cmds/send.c:501:11: [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. int c = getopt_long(argc, argv, "vqec:f:i:p:", long_options, NULL); data/btrfs-progs-5.9/cmds/send.c:517:13: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. subvol = realpath(optarg, NULL); data/btrfs-progs-5.9/cmds/send.c:561:22: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. snapshot_parent = realpath(optarg, NULL); data/btrfs-progs-5.9/cmds/send.c:625:11: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. subvol = realpath(argv[optind], NULL); data/btrfs-progs-5.9/cmds/send.c:655:12: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. subvol = realpath(argv[i], NULL); data/btrfs-progs-5.9/cmds/send.c:705:12: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. subvol = realpath(subvol, NULL); data/btrfs-progs-5.9/cmds/subvolume.c:111:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "c:i:"); data/btrfs-progs-5.9/cmds/subvolume.c:280:7: [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, "cCi:v", long_options, NULL); data/btrfs-progs-5.9/cmds/subvolume.c:342:10: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. cpath = realpath(path, NULL); data/btrfs-progs-5.9/cmds/subvolume.c:562:7: [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, data/btrfs-progs-5.9/cmds/subvolume.c:729:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "c:i:r"); data/btrfs-progs-5.9/cmds/subvolume.c:1052:7: [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, "r:u:", long_options, NULL); data/btrfs-progs-5.9/cmds/subvolume.c:1079:13: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. fullpath = realpath(argv[optind], NULL); data/btrfs-progs-5.9/cmds/subvolume.c:1277:11: [3] (buffer) getopt: 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. int c = getopt(argc, argv, "s:"); data/btrfs-progs-5.9/common/device-scan.c:60:6: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(input, path)) { data/btrfs-progs-5.9/common/help.c:101:11: [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. int c = getopt_long(argc, argv, "", long_options, NULL); data/btrfs-progs-5.9/common/path-utils.c:153:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (!realpath(loop_dev, real_loop_dev)) data/btrfs-progs-5.9/common/path-utils.c:185:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (!realpath(a, real_a)) data/btrfs-progs-5.9/common/path-utils.c:188:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (!realpath(b, real_b)) data/btrfs-progs-5.9/common/path-utils.c:323:14: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. canonical = realpath(path, NULL); data/btrfs-progs-5.9/common/utils.c:1297:16: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. *mount_root = realpath(longest_match, NULL); data/btrfs-progs-5.9/common/utils.c:1640:14: [3] (random) jrand48: 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. return (u32)jrand48(rand_seed); data/btrfs-progs-5.9/common/utils.c:1651:24: [3] (random) jrand48: 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. return (unsigned int)(jrand48(rand_seed) % upper); data/btrfs-progs-5.9/convert/main.c:1798:11: [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. int c = getopt_long(argc, argv, "dinN:rl:LpO:", long_options, NULL); data/btrfs-progs-5.9/image/main.c:2866:11: [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. int c = getopt_long(argc, argv, "rc:t:oswm", long_options, NULL); data/btrfs-progs-5.9/mkfs/main.c:987:7: [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, "A:b:fl:n:s:m:d:L:R:O:r:U:VMKq", data/btrfs-progs-5.9/mkfs/rootdir.c:465:20: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. dir_entry->path = realpath(dir_name, NULL); data/btrfs-progs-5.9/quick-test.c:60:2: [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(55); data/btrfs-progs-5.9/quick-test.c:88:2: [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(55); data/btrfs-progs-5.9/quick-test.c:117:2: [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(55); data/btrfs-progs-5.9/quick-test.c:145:2: [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(128); data/btrfs-progs-5.9/quick-test.c:164:2: [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(128); data/btrfs-progs-5.9/tests/fssum.c:656:14: [3] (buffer) getopt: 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. while ((c = getopt(argc, argv, allopts)) != EOF) { data/btrfs-progs-5.9/tests/ioctl-test.c:222:18: [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. value_to_string(random()); data/btrfs-progs-5.9/btrfs-corrupt-block.c:507: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 name[PATH_MAX]; data/btrfs-progs-5.9/btrfs-corrupt-block.c:1153: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 field[FIELD_BUF_LEN]; data/btrfs-progs-5.9/btrfs-crc.c:52:13: [2] (integer) atol: 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). length = atol(optarg); data/btrfs-progs-5.9/btrfs-fragments.c:44: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 fullname[2000]; data/btrfs-progs-5.9/btrfs-fragments.c:51: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). pngout = fopen(fullname, "w"); data/btrfs-progs-5.9/btrfs-fragments.c:197: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 name[1000]; data/btrfs-progs-5.9/btrfs-fragments.c:206: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). html = fopen(name, "w"); data/btrfs-progs-5.9/btrfs-list.c:435: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(&ri->uuid, uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:437: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(&ri->puuid, puuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:439: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(&ri->ruuid, ruuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:508: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(&ri->uuid, uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:511: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(&ri->puuid, puuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:514: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(&ri->ruuid, ruuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:591: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(tmp + add_len + 1, full_path, len); data/btrfs-progs-5.9/btrfs-list.c:593: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(tmp, found->path, add_len); data/btrfs-progs-5.9/btrfs-list.c:1042:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(uuid, ri->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:1043:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(puuid, ri->parent_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:1044:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ruuid, ri->received_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfs-list.c:1146: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(tmp + add_len + 1, ri->full_path, len); data/btrfs-progs-5.9/btrfs-list.c:1149: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(tmp, p, add_len); data/btrfs-progs-5.9/btrfs-list.c:1327: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 tstr[256]; data/btrfs-progs-5.9/btrfs-list.c:1328: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 uuidparse[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/btrfs-list.c:1445: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 barrier[20]; data/btrfs-progs-5.9/btrfs-list.c:1577: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(the_ri, ri, offsetof(struct root_info, path)); data/btrfs-progs-5.9/btrfs-list.c:1614: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(the_ri, ri, offsetof(struct root_info, path)); data/btrfs-progs-5.9/btrfs-map-logical.c:167: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[BUFFER_SIZE]; data/btrfs-progs-5.9/btrfs-map-logical.c:277:13: [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). out_fd = open(output_file, O_RDWR | O_CREAT, 0600); data/btrfs-progs-5.9/btrfs-sb-mod.c:31: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[BLOCKSIZE]; data/btrfs-progs-5.9/btrfs-sb-mod.c:56: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(&hdr->csum, result, csum_size); data/btrfs-progs-5.9/btrfs-sb-mod.c:341:7: [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_RDWR | O_EXCL); data/btrfs-progs-5.9/btrfstune.c:90: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(fsid_ret, fs_info->super_copy->fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.c:147: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(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.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(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.c:165: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(disk_super->metadata_uuid, disk_super->fsid, data/btrfs-progs-5.9/btrfstune.c:167: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(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.c:357: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(fs_info->super_copy->fsid, new_fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.c:363: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(fs_info->fs_devices->metadata_uuid, new_fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.c:394: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 uuid_buf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/btrfstune.c:419: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(old_fsid, (const char*)fs_info->fs_devices->fsid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/btrfstune.c:448: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(fs_info->fs_devices->fsid, new_fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.c:449: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(fs_info->super_copy->fsid, new_fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/btrfstune.c:579:7: [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(device, O_RDWR); data/btrfs-progs-5.9/check/main.c:489: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(rec, orig_rec, sizeof(*rec)); data/btrfs-progs-5.9/check/main.c:503: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(backref, orig, size); data/btrfs-progs-5.9/check/main.c:513: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(&new_record, hash_record, size); data/btrfs-progs-5.9/check/main.c:523: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(dst, src, size); data/btrfs-progs-5.9/check/main.c:944: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(backref->name, name, namelen); data/btrfs-progs-5.9/check/main.c:1355: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(&hash_record->key, key, sizeof(*key)); data/btrfs-progs-5.9/check/main.c:1356: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(hash_record + 1, namebuf, namelen); data/btrfs-progs-5.9/check/main.c:1380: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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/check/main.c:1465: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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/check/main.c:1514: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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/check/main.c:2304: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(name, backref->name, backref->namelen); data/btrfs-progs-5.9/check/main.c:2384: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/main.c:2402:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(namebuf, "%llu", rec->ino); data/btrfs-progs-5.9/check/main.c:3156: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(backref->name, name, namelen); data/btrfs-progs-5.9/check/main.c:3406: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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/check/main.c:4641: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(&rec->parent_key, &tmpl->parent_key, sizeof(tmpl->parent_key)); data/btrfs-progs-5.9/check/main.c:4740: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(&rec->parent_key, &tmpl->parent_key, data/btrfs-progs-5.9/check/main.c:6432: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(&bad->key, &key, data/btrfs-progs-5.9/check/main.c:8430: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(&ri_rec->drop_key, drop_key, sizeof(*drop_key)); data/btrfs-progs-5.9/check/main.c:9958: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 uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/check/mode-common.c:835: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-common.c:887: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-common.c:982: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-common.h:82:18: [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 unsigned char btrfs_type_by_mode[S_IFMT >> S_SHIFT] = { data/btrfs-progs-5.9/check/mode-lowmem.c:812: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 name[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:910: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:1103: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:1169: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(name_ret, namebuf, len); data/btrfs-progs-5.9/check/mode-lowmem.c:1242: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:1329: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 ref_namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:1672: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:2431: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:2441: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(namebuf, name, namelen); data/btrfs-progs-5.9/check/mode-lowmem.c:2444:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(namebuf, "%llu", ino); data/btrfs-progs-5.9/check/mode-lowmem.c:2609: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 namebuf[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:5208: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 ref_name[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-lowmem.c:5209: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 backref_name[BTRFS_NAME_LEN] = {0}; data/btrfs-progs-5.9/check/mode-original.h:120: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 name[0]; data/btrfs-progs-5.9/check/mode-original.h:244: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 name[0]; data/btrfs-progs-5.9/cmds/balance.c:599: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(&args.sys, &args.meta, data/btrfs-progs-5.9/cmds/balance.c:670:5: [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). open("/dev/null", O_RDONLY); data/btrfs-progs-5.9/cmds/balance.c:671:5: [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). open("/dev/null", O_WRONLY); data/btrfs-progs-5.9/cmds/balance.c:672:5: [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). open("/dev/null", O_WRONLY); data/btrfs-progs-5.9/cmds/device.c:111: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). devfd = open(argv[i], O_RDWR); data/btrfs-progs-5.9/cmds/device.c:279:7: [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("/dev/btrfs-control", O_RDWR); data/btrfs-progs-5.9/cmds/device.c:426:7: [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("/dev/btrfs-control", O_RDWR); data/btrfs-progs-5.9/cmds/device.c:535: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 path[BTRFS_DEVICE_PATH_NAME_MAX + 1]; data/btrfs-progs-5.9/cmds/device.c:537:18: [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. strncpy(path, (char *)di_args[i].path, data/btrfs-progs-5.9/cmds/device.c:553: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. const char name[32]; data/btrfs-progs-5.9/cmds/filesystem-du.c:48: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 path[PATH_MAX] = { 0, }; data/btrfs-progs-5.9/cmds/filesystem-du.c:298: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[16384]; data/btrfs-progs-5.9/cmds/filesystem-usage.c:616: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[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/cmds/filesystem-usage.c:620:7: [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(dev, O_RDONLY); data/btrfs-progs-5.9/cmds/filesystem-usage.c:632: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(fsid, disk_super->fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/cmds/filesystem-usage.c:700:4: [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(info[ndevs].path, "missing"); data/btrfs-progs-5.9/cmds/filesystem-usage.h:27: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[BTRFS_DEVICE_PATH_NAME_MAX]; data/btrfs-progs-5.9/cmds/filesystem.c:123: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 uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/filesystem.c:143: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 uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/filesystem.c:241: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 uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/filesystem.c:289: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 uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/filesystem.c:316: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((char *)tmp_dev_info->path, O_RDONLY); data/btrfs-progs-5.9/cmds/filesystem.c:347: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 label[BTRFS_LABEL_SIZE]; data/btrfs-progs-5.9/cmds/filesystem.c:382: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(mnt->mnt_dir, O_RDONLY); data/btrfs-progs-5.9/cmds/filesystem.c:433:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst->uuid, src->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/cmds/filesystem.c:465:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst->fsid, src->fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/cmds/filesystem.c:466:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst->metadata_uuid, src->metadata_uuid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/cmds/filesystem.c:649: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 mp[PATH_MAX]; data/btrfs-progs-5.9/cmds/filesystem.c:650: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[PATH_MAX]; data/btrfs-progs-5.9/cmds/filesystem.c:652: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 uuid_buf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/filesystem.c:864: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(fpath, defrag_open_mode); data/btrfs-progs-5.9/cmds/filesystem.c:1165: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 label[BTRFS_LABEL_SIZE]; data/btrfs-progs-5.9/cmds/inspect-dump-super.c:160: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(filename, O_RDONLY); data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:305: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 uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:442: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[dev_optind], O_RDONLY); data/btrfs-progs-5.9/cmds/inspect.c:155: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/inspect.c:291: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[PATH_MAX]; data/btrfs-progs-5.9/cmds/property.c:90:2: [2] (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 string. strcat(tmp, ".."); data/btrfs-progs-5.9/cmds/receive-dump.c:99: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 full_path[PATH_MAX] = {0}; data/btrfs-progs-5.9/cmds/receive-dump.c:142: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/receive-dump.c:154: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/receive-dump.c:155: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 parent_uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/receive-dump.c:202: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 full_to[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive-dump.c:237: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive-dump.c:300: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 at_str[TIME_STRING_MAX]; data/btrfs-progs-5.9/cmds/receive-dump.c:301: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 mt_str[TIME_STRING_MAX]; data/btrfs-progs-5.9/cmds/receive-dump.c:302: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 ct_str[TIME_STRING_MAX]; data/btrfs-progs-5.9/cmds/receive-dump.h:23: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 full_subvol_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive-dump.h:24: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 root_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:62: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 write_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:66: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 full_subvol_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:75: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 cur_subvol_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:86: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 cached_capabilities[64]; data/btrfs-progs-5.9/cmds/receive.c:95: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/receive.c:110: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(rs_args.uuid, rctx->cur_subvol.received_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/cmds/receive.c:160: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/receive.c:199: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(rctx->cur_subvol.received_uuid, uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/cmds/receive.c:228: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/receive.c:268: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(rctx->cur_subvol.received_uuid, uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/cmds/receive.c:381: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:409: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:434: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:460: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:485: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:510: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:535: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 full_from[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:536: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 full_to[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:567: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:568: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 full_link_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:600: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:625: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:657:19: [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). rctx->write_fd = open(path, O_RDWR); data/btrfs-progs-5.9/cmds/receive.c:684: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:726: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:728: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 full_clone_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:820: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:841: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(rctx->cached_capabilities, data, len); data/btrfs-progs-5.9/cmds/receive.c:866: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:894: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:920: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:946: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:991: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 full_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:1061: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 root_subvol_path[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:1071:22: [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). rctx->dest_dir_fd = open(dest_dir_full_path, O_RDONLY | O_NOATIME); data/btrfs-progs-5.9/cmds/receive.c:1097:17: [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). rctx->mnt_fd = open(rctx->root_path, O_RDONLY | O_NOATIME); data/btrfs-progs-5.9/cmds/receive.c:1257: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 fromfile[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:1258: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 realmnt[PATH_MAX]; data/btrfs-progs-5.9/cmds/receive.c:1349:16: [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). receive_fd = open(fromfile, O_RDONLY | O_NOATIME); data/btrfs-progs-5.9/cmds/replace.c:255:13: [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). fddstdev = open(dstdev, O_RDWR); data/btrfs-progs-5.9/cmds/replace.c:378: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 string1[80]; data/btrfs-progs-5.9/cmds/replace.c:379: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 string2[80]; data/btrfs-progs-5.9/cmds/replace.c:380: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 string3[80]; data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:191: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(chunk_stripe->dev_uuid, record->stripes[i].dev_uuid, data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:845: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(dev->name, O_RDONLY); data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:951: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(uuid, stripe->dev_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1196: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(dev_item->uuid, dev->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1197: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(dev_item->fsid, dev->fs_devices->metadata_uuid, data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1511: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[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1515:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1642: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(chunk->stripes[i].dev_uuid, device->uuid, data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1743: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(chunk->stripes[index].dev_uuid, data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1791: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(chunk->stripes[index].dev_uuid, device->uuid, data/btrfs-progs-5.9/cmds/rescue-chunk-recover.c:1956: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(chunk->stripes[index].dev_uuid, dev->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/cmds/rescue-super-recover.c:106: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(&record->sb, sb, sizeof(*sb)); data/btrfs-progs-5.9/cmds/rescue-super-recover.c:124:7: [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, O_RDONLY); data/btrfs-progs-5.9/cmds/rescue-super-recover.c:236:7: [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(dname, O_RDONLY); data/btrfs-progs-5.9/cmds/restore.c:50: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 fs_name[PATH_MAX]; data/btrfs-progs-5.9/cmds/restore.c:51: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 path_name[PATH_MAX]; data/btrfs-progs-5.9/cmds/restore.c:52: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 symlink_target[PATH_MAX]; data/btrfs-progs-5.9/cmds/restore.c:94: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(&dlen, buf, LZO_LEN); data/btrfs-progs-5.9/cmds/restore.c:291: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[4096]; data/btrfs-progs-5.9/cmds/restore.c:477: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[16]; data/btrfs-progs-5.9/cmds/restore.c:959: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 filename[BTRFS_NAME_LEN + 1]; data/btrfs-progs-5.9/cmds/restore.c:1062:9: [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(path_name, O_CREAT|O_WRONLY, 0644); data/btrfs-progs-5.9/cmds/restore.c:1174: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(path_name, O_RDONLY); data/btrfs-progs-5.9/cmds/restore.c:1413: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 dir_name[PATH_MAX]; data/btrfs-progs-5.9/cmds/restore.c:1425: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 reg_err[256]; data/btrfs-progs-5.9/cmds/scrub.c:164: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 t[4096]; data/btrfs-progs-5.9/cmds/scrub.c:261: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 t[4096]; data/btrfs-progs-5.9/cmds/scrub.c:401:7: [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(datafile, m, 0600); data/btrfs-progs-5.9/cmds/scrub.c:418: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 datafile[PATH_MAX]; data/btrfs-progs-5.9/cmds/scrub.c:430: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 datafile[PATH_MAX]; data/btrfs-progs-5.9/cmds/scrub.c:442: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 datafile_old[PATH_MAX]; data/btrfs-progs-5.9/cmds/scrub.c:443: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 datafile_new[PATH_MAX]; data/btrfs-progs-5.9/cmds/scrub.c:500: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 l[SZ_16K]; data/btrfs-progs-5.9/cmds/scrub.c:509: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 empty_uuid[BTRFS_FSID_SIZE] = {0}; data/btrfs-progs-5.9/cmds/scrub.c:766:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/btrfs-progs-5.9/cmds/scrub.c:917: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 fsid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/scrub.c:1009: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(sp, sp_last, sizeof(*sp)); data/btrfs-progs-5.9/cmds/scrub.c:1019: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(sp, sp_shared, sizeof(*sp)); data/btrfs-progs-5.9/cmds/scrub.c:1020: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(sp_last, sp_shared, sizeof(*sp)); data/btrfs-progs-5.9/cmds/scrub.c:1166: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 fsid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/scrub.c:1167: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 sock_path[PATH_MAX] = ""; data/btrfs-progs-5.9/cmds/scrub.c:1726: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 fsid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/send.c:345:17: [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). sctx->mnt_fd = open(sctx->root_path, O_RDONLY | O_NOATIME); data/btrfs-progs-5.9/cmds/send.c:467: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 outname[PATH_MAX]; data/btrfs-progs-5.9/cmds/send.c:603: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). tmpfd = open(outname, O_WRONLY | O_TRUNC); data/btrfs-progs-5.9/cmds/send.c:606:13: [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). tmpfd = open(outname, data/btrfs-progs-5.9/cmds/subvolume.c:262: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 uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/subvolume.c:263: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 full_subvolpath[BTRFS_SUBVOL_NAME_MAX]; data/btrfs-progs-5.9/cmds/subvolume.c:1024: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 tstr[256]; data/btrfs-progs-5.9/cmds/subvolume.c:1025: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 uuidparse[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/cmds/subvolume.c:1284:21: [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). sleep_interval = atoi(optarg); data/btrfs-progs-5.9/common/device-scan.c:55: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[PATH_MAX]; data/btrfs-progs-5.9/common/device-scan.c:179: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(disk_super, super, sizeof(*disk_super)); data/btrfs-progs-5.9/common/device-scan.c:189: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(&dev_item->uuid, device->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/common/device-scan.c:211:7: [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("/dev/btrfs-control", O_RDWR); data/btrfs-progs-5.9/common/device-scan.c:333: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(alloc->fsid, fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/common/device-scan.c:372: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[PATH_MAX]; data/btrfs-progs-5.9/common/device-scan.c:393: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(path, O_RDONLY); data/btrfs-progs-5.9/common/device-utils.c:109: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[BUFSIZ]; data/btrfs-progs-5.9/common/device-utils.c:242: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). int fd = open(dev, O_RDONLY); data/btrfs-progs-5.9/common/format-output.c:27: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 uuidparse[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/common/format-output.c:278:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tstr[256]; data/btrfs-progs-5.9/common/format-output.h:70: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 jtype[JSON_NESTING_LIMIT]; data/btrfs-progs-5.9/common/fsfeatures.c:173:5: [2] (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 string. strcat(buf, ", "); data/btrfs-progs-5.9/common/fsfeatures.c:317:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). version = atoi(tmp) << 16; data/btrfs-progs-5.9/common/fsfeatures.c:321:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). version |= atoi(tmp) << 8; data/btrfs-progs-5.9/common/fsfeatures.c:325:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). version |= atoi(tmp); data/btrfs-progs-5.9/common/help.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 argv0_buf[ARGV0_BUF_SIZE] = "btrfs"; data/btrfs-progs-5.9/common/help.h:76: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 name[8]; data/btrfs-progs-5.9/common/path-utils.c:122:7: [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(loop_dev, O_RDONLY | O_NONBLOCK); data/btrfs-progs-5.9/common/path-utils.c:131: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(loop_file, lo64.lo_file_name, sizeof(lo64.lo_file_name)); data/btrfs-progs-5.9/common/path-utils.c:149: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 fmt[20]; data/btrfs-progs-5.9/common/path-utils.c:150: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 p[PATH_MAX]; data/btrfs-progs-5.9/common/path-utils.c:151: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 real_loop_dev[PATH_MAX]; data/btrfs-progs-5.9/common/path-utils.c:156:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = fopen(p, "r"))) { data/btrfs-progs-5.9/common/path-utils.c:182: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 real_a[PATH_MAX]; data/btrfs-progs-5.9/common/path-utils.c:183:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char real_b[PATH_MAX]; data/btrfs-progs-5.9/common/path-utils.c:222: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 res_a[PATH_MAX]; data/btrfs-progs-5.9/common/path-utils.c:223: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 res_b[PATH_MAX]; data/btrfs-progs-5.9/common/path-utils.c:289: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[PATH_MAX], name[PATH_MAX], *res = NULL; data/btrfs-progs-5.9/common/path-utils.c:295:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = fopen(path, "r"))) data/btrfs-progs-5.9/common/send-stream.c:29: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 read_buf[BTRFS_SEND_BUF_SIZE]; data/btrfs-progs-5.9/common/send-stream.c:257: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(*str, data, len); data/btrfs-progs-5.9/common/send-stream.c:295: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(uuid, data, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/common/send-utils.c:117: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(buf, item, btrfs_search_header_len(sh)); data/btrfs-progs-5.9/common/send-utils.c:345: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. if (((char *)buf)[i] == b) data/btrfs-progs-5.9/common/send-utils.c:504: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(info->uuid, root_item.uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/common/send-utils.c:505: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(info->received_uuid, root_item.received_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/common/send-utils.c:506: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(info->parent_uuid, root_item.parent_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/common/send-utils.c:674: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(si->uuid, root_item.uuid, data/btrfs-progs-5.9/common/send-utils.c:676: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(si->parent_uuid, root_item.parent_uuid, data/btrfs-progs-5.9/common/send-utils.c:678: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(si->received_uuid, data/btrfs-progs-5.9/common/send-utils.c:765:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(out, "%.*s/%.*s", p1_len, p1, p2_len, p2); data/btrfs-progs-5.9/common/send-utils.c:785:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(out, "%.*s/%.*s/%.*s", p1_len, p1, p2_len, p2, p3_len, p3); data/btrfs-progs-5.9/common/utils.c:126:7: [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(dev, O_RDONLY); data/btrfs-progs-5.9/common/utils.c:154: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 mp[PATH_MAX]; data/btrfs-progs-5.9/common/utils.c:251:7: [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(file, O_RDONLY); data/btrfs-progs-5.9/common/utils.c:330: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 name[PATH_MAX]; data/btrfs-progs-5.9/common/utils.c:340:18: [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 __thread char ps_array[10][32]; data/btrfs-progs-5.9/common/utils.c:520: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 label[BTRFS_LABEL_SIZE]; data/btrfs-progs-5.9/common/utils.c:522:7: [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(mount_path, O_RDONLY | O_NOATIME); data/btrfs-progs-5.9/common/utils.c:573: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 label[BTRFS_LABEL_SIZE]; data/btrfs-progs-5.9/common/utils.c:577:7: [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(mount_path, O_RDONLY | O_NOATIME); data/btrfs-progs-5.9/common/utils.c:747:7: [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(p, O_RDONLY); data/btrfs-progs-5.9/common/utils.c:801: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(fname, open_flags); data/btrfs-progs-5.9/common/utils.c:987: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 mp[PATH_MAX]; data/btrfs-progs-5.9/common/utils.c:994: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[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/common/utils.c:997: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(path, O_RDONLY); data/btrfs-progs-5.9/common/utils.c:1025: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(fi_args->fsid, fs_devices_mnt->fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/common/utils.c:1075: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(di_args, &tmp, sizeof(tmp)); data/btrfs-progs-5.9/common/utils.c:1106:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/common/utils.c:1120: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(fsid, args.fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/common/utils.c:1233: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[30] = {0,}; data/btrfs-progs-5.9/common/utils.c:1260:7: [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(path, O_RDONLY | O_NOATIME); data/btrfs-progs-5.9/common/utils.c:1395: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 args2_buf[args2_size]; data/btrfs-progs-5.9/common/utils.c:1615:7: [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("/dev/urandom", O_RDONLY); data/btrfs-progs-5.9/common/utils.c:1764:4: [2] (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 string. strcat(ptr, ", "); data/btrfs-progs-5.9/common/utils.c:1821:4: [2] (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 string. strcat(*types_ret, "data"); data/btrfs-progs-5.9/common/utils.c:1824:5: [2] (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 string. strcat(*types_ret, ", "); data/btrfs-progs-5.9/common/utils.c:1825:4: [2] (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 string. strcat(*types_ret, "metadata"); data/btrfs-progs-5.9/common/utils.c:1829:5: [2] (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 string. strcat(*types_ret, ", "); data/btrfs-progs-5.9/common/utils.c:1830:4: [2] (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 string. strcat(*types_ret, "data+metadata"); data/btrfs-progs-5.9/common/utils.c:1834:5: [2] (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 string. strcat(*types_ret, ", "); data/btrfs-progs-5.9/common/utils.c:1835:4: [2] (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 string. strcat(*types_ret, "system"); data/btrfs-progs-5.9/convert/common.c:71:8: [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(&sb->csum[0], result, BTRFS_CSUM_SIZE); data/btrfs-progs-5.9/convert/common.c:93: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. unsigned char chunk_uuid[BTRFS_UUID_SIZE]; data/btrfs-progs-5.9/convert/common.c:94: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 super_buf[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/convert/common.c:157: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. unsigned char fsid[BTRFS_FSID_SIZE]; data/btrfs-progs-5.9/convert/common.c:158: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. unsigned char chunk_uuid[BTRFS_UUID_SIZE]; data/btrfs-progs-5.9/convert/common.c:299: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 super_buf[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/convert/common.c:300: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. unsigned char dev_uuid[BTRFS_UUID_SIZE]; data/btrfs-progs-5.9/convert/common.c:301: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. unsigned char fsid[BTRFS_FSID_SIZE]; data/btrfs-progs-5.9/convert/common.c:361: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 super_buf[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/convert/common.c:409: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(cur, &disk_key, sizeof(disk_key)); data/btrfs-progs-5.9/convert/main.c:1143: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 subvol_name[SOURCE_FS_NAME_LEN + 8]; data/btrfs-progs-5.9/convert/main.c:1145: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 features_buf[64]; data/btrfs-progs-5.9/convert/main.c:1175:7: [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(devname, O_RDWR); data/btrfs-progs-5.9/convert/main.c:1182:3: [2] (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 string. strcat(features_buf, " (default)"); data/btrfs-progs-5.9/convert/main.c:1579: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 *reserved_ranges[ARRAY_SIZE(btrfs_reserved_ranges)] = { NULL }; data/btrfs-progs-5.9/convert/main.c:1597:7: [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(devname, O_RDWR); data/btrfs-progs-5.9/convert/main.c:1771: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 fslabel[BTRFS_LABEL_SIZE]; data/btrfs-progs-5.9/convert/main.c:1851:6: [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[64]; data/btrfs-progs-5.9/convert/source-ext2.c:500: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 namebuf[XATTR_NAME_MAX + 1]; data/btrfs-progs-5.9/convert/source-ext2.c:552: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 inode_buf[EXT2_GOOD_OLD_INODE_SIZE]; data/btrfs-progs-5.9/convert/source-fs.h:117: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. const char name[SOURCE_FS_NAME_LEN]; data/btrfs-progs-5.9/convert/source-reiserfs.c:331: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(bdata->inline_data + bdata->inline_length, body, len); data/btrfs-progs-5.9/convert/source-reiserfs.c:730: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(xa_data->body + position, body, len); data/btrfs-progs-5.9/crypto/blake2-impl.h:37: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(&w, src, sizeof w); data/btrfs-progs-5.9/crypto/blake2-impl.h: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(&w, src, sizeof w); data/btrfs-progs-5.9/crypto/blake2-impl.h:71: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(&w, src, sizeof w); data/btrfs-progs-5.9/crypto/blake2-impl.h:83: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(dst, &w, sizeof w); data/btrfs-progs-5.9/crypto/blake2-impl.h:94: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(dst, &w, sizeof w); data/btrfs-progs-5.9/crypto/blake2-impl.h:107: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(dst, &w, sizeof w); data/btrfs-progs-5.9/crypto/blake2b-ref.c:146: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( block, key, keylen ); data/btrfs-progs-5.9/crypto/blake2b-ref.c:231: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( S->buf + left, in, fill ); /* Fill buffer */ data/btrfs-progs-5.9/crypto/blake2b-ref.c:242: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( S->buf + S->buflen, in, inlen ); data/btrfs-progs-5.9/crypto/blake2b-ref.c:267: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( out, buffer, S->outlen ); data/btrfs-progs-5.9/crypto/hash-speedtest.c:35:16: [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(out, buf, CRYPTO_HASH_SIZE_MAX); data/btrfs-progs-5.9/crypto/hash-speedtest.c:56: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 name[16]; data/btrfs-progs-5.9/crypto/hash-speedtest.c:70:16: [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). iterations = atoi(argv[1]); data/btrfs-progs-5.9/crypto/sha.h:217: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 k_opad[USHA_Max_Message_Block_Size]; data/btrfs-progs-5.9/crypto/sha.h:232: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 prk[USHAMaxHashSize]; data/btrfs-progs-5.9/crypto/sha.h:330:53: [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. extern int hkdf(SHAversion whichSha, const unsigned char *salt, data/btrfs-progs-5.9/crypto/sha.h:331: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. int salt_len, const unsigned char *ikm, int ikm_len, data/btrfs-progs-5.9/crypto/sha.h:332:32: [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. const unsigned char *info, int info_len, data/btrfs-progs-5.9/crypto/sha.h:334:60: [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. extern int hkdfExtract(SHAversion whichSha, const unsigned char *salt, data/btrfs-progs-5.9/crypto/sha.h:335:53: [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. int salt_len, const unsigned char *ikm, data/btrfs-progs-5.9/crypto/sha.h:338:51: [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. int prk_len, const unsigned char *info, data/btrfs-progs-5.9/crypto/sha.h:354:38: [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. const unsigned char *info, int info_len, data/btrfs-progs-5.9/crypto/xxhash.c:112:76: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } data/btrfs-progs-5.9/crypto/xxhash.c:518: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(dstState, srcState, sizeof(*dstState)); data/btrfs-progs-5.9/crypto/xxhash.c:530: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(statePtr, &state, sizeof(state) - sizeof(state.reserved)); data/btrfs-progs-5.9/crypto/xxhash.c:630: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(dst, &hash, sizeof(*dst)); data/btrfs-progs-5.9/crypto/xxhash.c:992: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(dstState, srcState, sizeof(*dstState)); data/btrfs-progs-5.9/crypto/xxhash.c:1004: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(statePtr, &state, sizeof(state) - sizeof(state.reserved)); data/btrfs-progs-5.9/crypto/xxhash.c:1100: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(dst, &hash, sizeof(*dst)); data/btrfs-progs-5.9/crypto/xxhash.h:221:27: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. typedef struct { unsigned char digest[4]; } XXH32_canonical_t; data/btrfs-progs-5.9/crypto/xxhash.h:263:27: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. typedef struct { unsigned char digest[8]; } XXH64_canonical_t; data/btrfs-progs-5.9/crypto/xxhash.h:426:18: [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. XXH_ALIGN(64) char customSecret[XXH3_SECRET_DEFAULT_SIZE]; /* used to store a custom secret generated from the seed. Makes state larger. Design might change */ data/btrfs-progs-5.9/crypto/xxhash.h:427:18: [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. XXH_ALIGN(64) char buffer[XXH3_INTERNALBUFFER_SIZE]; data/btrfs-progs-5.9/crypto/xxhash.h:520:27: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. typedef struct { unsigned char digest[16]; } XXH128_canonical_t; data/btrfs-progs-5.9/image/main.c:63: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 meta_cluster_bytes[BLOCK_SIZE]; data/btrfs-progs-5.9/image/main.c:136: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(buf, result, csum_size); data/btrfs-progs-5.9/image/main.c:326:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst, src->data, src->len); data/btrfs-progs-5.9/image/main.c:482: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 zero[BLOCK_SIZE]; data/btrfs-progs-5.9/image/main.c:1071: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(chunk->stripe.dev_uuid, super->dev_item.uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/image/main.c:1133: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(chunk->stripe.dev_uuid, super->dev_item.uuid, data/btrfs-progs-5.9/image/main.c:1225: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(eb->data, buffer, mdres->nodesize); data/btrfs-progs-5.9/image/main.c:1283: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(buffer, eb->data, eb->len); data/btrfs-progs-5.9/image/main.c:1386: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(mdres->original_super, outbuf, data/btrfs-progs-5.9/image/main.c:1577: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(mdres->fsid, super->metadata_uuid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/image/main.c:1579: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(mdres->fsid, super->fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/image/main.c:1580: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(mdres->uuid, super->dev_item.uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/image/main.c:1643:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[BLOCK_MASK]; data/btrfs-progs-5.9/image/main.c:1798: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(eb->data, buffer + cur_offset, nodesize); data/btrfs-progs-5.9/image/main.c:2182: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(mdres->fsid, super->metadata_uuid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/image/main.c:2184: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(mdres->fsid, super->fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/image/main.c:2186: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(mdres->uuid, super->dev_item.uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/image/main.c:2621: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). in = fopen(input, "r"); data/btrfs-progs-5.9/image/main.c:2739: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 dev_uuid[BTRFS_UUID_SIZE]; data/btrfs-progs-5.9/image/main.c:2740: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 fs_uuid[BTRFS_UUID_SIZE]; data/btrfs-progs-5.9/image/main.c:2743: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[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/image/main.c:2786:7: [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). fp = open(other_dev, O_CREAT | O_RDWR, 0600); data/btrfs-progs-5.9/image/main.c:2793: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(buf, info->super_copy, BTRFS_SUPER_INFO_SIZE); data/btrfs-progs-5.9/image/main.c:2805: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(dev_item->uuid, dev_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/image/main.c:2806: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(dev_item->fsid, fs_uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/image/main.c:2949: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). out = fopen(target, "w+"); data/btrfs-progs-5.9/image/sanitize.c:452: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(eb->data, src->data, src->len); data/btrfs-progs-5.9/image/sanitize.c:472:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst, eb->data, eb->len); data/btrfs-progs-5.9/ioctl.h:46: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 name[BTRFS_PATH_NAME_MAX + 1]; data/btrfs-progs-5.9/ioctl.h:108: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 name[BTRFS_SUBVOL_NAME_MAX + 1]; data/btrfs-progs-5.9/ioctl.h:322: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 name[BTRFS_INO_LOOKUP_PATH_MAX]; data/btrfs-progs-5.9/ioctl.h:333: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 name[BTRFS_VOL_NAME_MAX + 1]; data/btrfs-progs-5.9/ioctl.h:338: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[BTRFS_INO_LOOKUP_USER_PATH_MAX]; data/btrfs-progs-5.9/ioctl.h:394: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[BTRFS_SEARCH_ARGS_BUFSIZE]; data/btrfs-progs-5.9/ioctl.h:594: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 uuid[BTRFS_UUID_SIZE]; /* in */ data/btrfs-progs-5.9/ioctl.h:624: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 uuid[BTRFS_UUID_SIZE]; /* in */ data/btrfs-progs-5.9/ioctl.h:711: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 name[BTRFS_VOL_NAME_MAX + 1]; data/btrfs-progs-5.9/kernel-lib/raid56.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(data[dest], data[1 - dest], stripe_len); data/btrfs-progs-5.9/kernel-shared/backref.c:411: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(new_ref, ref, sizeof(*ref)); data/btrfs-progs-5.9/kernel-shared/ctree.c:44: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. const char name[14]; data/btrfs-progs-5.9/kernel-shared/ctree.c:140: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(new_root, root, sizeof(*new_root)); data/btrfs-progs-5.9/kernel-shared/ctree.h:455: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 label[BTRFS_LABEL_SIZE]; data/btrfs-progs-5.9/kernel-shared/delayed-ref.c:388: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(&existing->extent_op->key, data/btrfs-progs-5.9/kernel-shared/disk-io.c:110: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 fs_uuid[BTRFS_UUID_UNPARSED_SIZE] = {'\0'}; data/btrfs-progs-5.9/kernel-shared/disk-io.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 found_uuid[BTRFS_UUID_UNPARSED_SIZE] = {'\0'}; data/btrfs-progs-5.9/kernel-shared/disk-io.c:685: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(&root->root_key, location, sizeof(*location)); data/btrfs-progs-5.9/kernel-shared/disk-io.c:1344:7: [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). fp = open(filename, oflags); data/btrfs-progs-5.9/kernel-shared/disk-io.c:1494: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 fsid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/disk-io.c:1495: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 dev_fsid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/disk-io.c:1571:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/kernel-shared/disk-io.c:1596: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(sb, buf, BTRFS_SUPER_INFO_SIZE); data/btrfs-progs-5.9/kernel-shared/disk-io.c:1643: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(sb, buf, BTRFS_SUPER_INFO_SIZE); data/btrfs-progs-5.9/kernel-shared/disk-io.c:1675: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(&sb->csum[0], result, BTRFS_CSUM_SIZE); data/btrfs-progs-5.9/kernel-shared/disk-io.c:1710: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(&sb->csum[0], result, BTRFS_CSUM_SIZE); data/btrfs-progs-5.9/kernel-shared/disk-io.c:1844: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(dev_item->uuid, dev->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/kernel-shared/disk-io.c:1845: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(dev_item->fsid, fs_info->fs_devices->metadata_uuid, data/btrfs-progs-5.9/kernel-shared/extent_io.c:916: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(eb->data, buf + total_write, this_len); data/btrfs-progs-5.9/kernel-shared/extent_io.c:998:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst, eb->data + start, len); data/btrfs-progs-5.9/kernel-shared/extent_io.c:1004: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(eb->data + start, src, len); data/btrfs-progs-5.9/kernel-shared/extent_io.c:1011:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst->data + dst_offset, src->data + src_offset, len); data/btrfs-progs-5.9/kernel-shared/free-space-cache.c:262: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(entry->bitmap, io_ctl->cur, io_ctl->root->fs_info->sectorsize); data/btrfs-progs-5.9/kernel-shared/inode.c:594: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[BTRFS_NAME_LEN + 1]; /* for snprintf null */ data/btrfs-progs-5.9/kernel-shared/inode.c:647: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(buf, base, len); data/btrfs-progs-5.9/kernel-shared/print-tree.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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:107: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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:139: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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:168: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(ret, "DATA"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:173:3: [2] (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 string. strcat(ret, "METADATA"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:178:3: [2] (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 string. strcat(ret, "SYSTEM"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:182:3: [2] (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 string. strcat(ret, "|RAID0"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:185:3: [2] (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 string. strcat(ret, "|RAID1"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:188:3: [2] (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 string. strcat(ret, "|RAID1C3"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:191:3: [2] (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 string. strcat(ret, "|RAID1C4"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:194:3: [2] (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 string. strcat(ret, "|DUP"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:197:3: [2] (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 string. strcat(ret, "|RAID10"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:200:3: [2] (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 string. strcat(ret, "|RAID5"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:203:3: [2] (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 string. strcat(ret, "|RAID6"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:214: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(ret, "ON"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:216: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(ret, "OFF"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:219:3: [2] (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 string. strcat(ret, "|SCANNING"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:221:3: [2] (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 string. strcat(ret, "|INCONSISTENT"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:229: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 chunk_flags_str[32] = {0}; data/btrfs-progs-5.9/kernel-shared/print-tree.c:257:12: [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 dev_uuid[BTRFS_UUID_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:258:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str_dev_uuid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:286: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:287: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 fsid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:322: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 fs_uuid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:323: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 chunk_uuid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:345: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(ret, "none"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:348: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(ret, "zlib"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:351: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(ret, "lzo"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:354: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(ret, "zstd"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:357:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(ret, "UNKNOWN.%d", compress_type); data/btrfs-progs-5.9/kernel-shared/print-tree.c:377: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 compress_str[16]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:422: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(ret, "DATA"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:429:3: [2] (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 string. strcat(ret, "TREE_BLOCK"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:433:3: [2] (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 string. strcat(ret, "FULL_BACKREF"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:450: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 flags_str[32] = {0}; data/btrfs-progs-5.9/kernel-shared/print-tree.c:525: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 namebuf[BTRFS_NAME_LEN]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:553:3: [2] (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 string. strcat(ret, "RDONLY"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:555:3: [2] (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 string. strcat(ret, "none"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:566: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 timestamp[256]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:583: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:584: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 flags_str[32] = {0}; data/btrfs-progs-5.9/kernel-shared/print-tree.c:923:3: [2] (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 string. strcat(ret, "none"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:929: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 flags_str[256]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:1019: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 flags_str[256]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:1067: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 uuid_str[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:1088: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 flags_str[256]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:1190: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(ret, "WRITTEN"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:1195:3: [2] (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 string. strcat(ret, "RELOC"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:1204: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 flags_str[128]; data/btrfs-progs-5.9/kernel-shared/print-tree.c:1848: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, buf[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/kernel-shared/root-tree.c:61: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(key, &found_key, sizeof(found_key)); data/btrfs-progs-5.9/kernel-shared/volumes.c:246: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(fs_devices->fsid, disk_super->fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/kernel-shared/volumes.c:248: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(fs_devices->metadata_uuid, data/btrfs-progs-5.9/kernel-shared/volumes.c:251: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(fs_devices->metadata_uuid, fs_devices->fsid, data/btrfs-progs-5.9/kernel-shared/volumes.c:271: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(device->uuid, disk_super->dev_item.uuid, data/btrfs-progs-5.9/kernel-shared/volumes.c:398: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(device->name, flags); data/btrfs-progs-5.9/kernel-shared/volumes.c:427: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[BTRFS_SUPER_INFO_SIZE]; data/btrfs-progs-5.9/kernel-shared/volumes.c:878: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(ptr, &disk_key, sizeof(disk_key)); data/btrfs-progs-5.9/kernel-shared/volumes.c:880: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(ptr, chunk, item_size); data/btrfs-progs-5.9/kernel-shared/volumes.c:1200: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(stripe->dev_uuid, device->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/kernel-shared/volumes.c:1323: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(stripe->dev_uuid, device->uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/kernel-shared/volumes.c:2084: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(fs_devices->fsid, fsid, BTRFS_FSID_SIZE); data/btrfs-progs-5.9/kernel-shared/volumes.c:2327: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(eb->data + dest_off, orig_eb->data + orig_off, copy_len); data/btrfs-progs-5.9/kernel-shared/volumes.c:2380: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(eb->data, orig_eb->data + eb->start - start, data/btrfs-progs-5.9/kernel-shared/volumes.h:126: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. const char raid_name[8]; /* name of the raid */ data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:33: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 name[BTRFS_PATH_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:123: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 name[BTRFS_SUBVOL_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:424: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 name[BTRFS_INO_LOOKUP_PATH_MAX]; data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:434: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 name[BTRFS_VOL_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:439: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[BTRFS_INO_LOOKUP_USER_PATH_MAX]; data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:517: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[BTRFS_SEARCH_ARGS_BUFSIZE]; data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:705: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 uuid[BTRFS_UUID_SIZE]; /* in */ data/btrfs-progs-5.9/libbtrfsutil/btrfs.h:758: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 name[BTRFS_VOL_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/btrfsutil_internal.h:50: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(&tmp, &sh->transid, sizeof(__u64)); data/btrfs-progs-5.9/libbtrfsutil/btrfsutil_internal.h:57: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(&tmp, &sh->objectid, sizeof(__u64)); data/btrfs-progs-5.9/libbtrfsutil/btrfsutil_internal.h:64: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(&tmp, &sh->offset, sizeof(__u64)); data/btrfs-progs-5.9/libbtrfsutil/btrfsutil_internal.h:71: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(&tmp, &sh->type, sizeof(__u32)); data/btrfs-progs-5.9/libbtrfsutil/btrfsutil_internal.h:78: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(&tmp, &sh->len, sizeof(__u32)); data/btrfs-progs-5.9/libbtrfsutil/filesystem.c:32:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/filesystem.c:58:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/filesystem.c:84:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:106:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:140:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:236: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(new_p, p, path + capacity - p); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:243: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(p, name, name_len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:245: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(p, lookup.name, lookup_len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:292:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:475:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:490:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:527:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:602:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:649: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(tmp_path, path, len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:671: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(name, basename, len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:689: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 name[BTRFS_SUBVOL_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:734: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(args.name, name, len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:944:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1041: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 child_name[BTRFS_SUBVOL_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1104:7: [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(source, O_RDONLY); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1120: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 name[BTRFS_SUBVOL_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1171: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(args.name, name, len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1209: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 child_name[BTRFS_PATH_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1244: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 name[BTRFS_PATH_NAME_MAX + 1]; data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1283: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(args.name, name, len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1365: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(p, dir, dir_len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1369: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(p, name, name_len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1491:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(*path_ret, iter->cur_path, top->path_len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1572:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(*path_ret, iter->cur_path, top->path_len); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1617:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/mkfs/common.c:87: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(root_item.uuid, uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/mkfs/common.c:92: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(root_item.uuid, uuid, BTRFS_UUID_SIZE); data/btrfs-progs-5.9/mkfs/common.c:373: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(ptr, &disk_key, sizeof(disk_key)); data/btrfs-progs-5.9/mkfs/common.c:463: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(buf->data, &super, sizeof(super)); data/btrfs-progs-5.9/mkfs/common.c:586:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[PATH_MAX]; data/btrfs-progs-5.9/mkfs/common.c:587: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[PATH_MAX]; data/btrfs-progs-5.9/mkfs/common.c:601: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). if ((f = fopen("/proc/swaps", "r")) == NULL) data/btrfs-progs-5.9/mkfs/common.c:738:7: [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(file, O_RDWR|O_EXCL); data/btrfs-progs-5.9/mkfs/common.c:792:7: [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(file, O_RDONLY); data/btrfs-progs-5.9/mkfs/common.c:819:7: [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(file, O_RDONLY); data/btrfs-progs-5.9/mkfs/common.h:73: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 fs_uuid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/mkfs/common.h: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 chunk_uuid[BTRFS_UUID_UNPARSED_SIZE]; data/btrfs-progs-5.9/mkfs/main.c:413: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[SZ_4K]; data/btrfs-progs-5.9/mkfs/main.c:438: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 wholedisk[PATH_MAX]; data/btrfs-progs-5.9/mkfs/main.c:439: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 sysfs_path[PATH_MAX]; data/btrfs-progs-5.9/mkfs/main.c:469:7: [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(sysfs_path, O_RDONLY); data/btrfs-progs-5.9/mkfs/main.c:949: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 fs_uuid[BTRFS_UUID_UNPARSED_SIZE] = { 0 }; data/btrfs-progs-5.9/mkfs/main.c:1230: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(file, oflags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | data/btrfs-progs-5.9/mkfs/main.c:1301:7: [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(file, O_RDWR); data/btrfs-progs-5.9/mkfs/main.c:1405: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(file, O_RDWR); data/btrfs-progs-5.9/mkfs/main.c:1507: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 features_buf[64]; data/btrfs-progs-5.9/mkfs/rootdir.c:230: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 xattr_list[XATTR_LIST_MAX]; data/btrfs-progs-5.9/mkfs/rootdir.c:233: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 cur_value[XATTR_SIZE_MAX]; data/btrfs-progs-5.9/mkfs/rootdir.c:279: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[PATH_MAX]; data/btrfs-progs-5.9/mkfs/rootdir.c:320:7: [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(path_name, O_RDONLY); data/btrfs-progs-5.9/mkfs/rootdir.c:572: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 tmp[PATH_MAX]; data/btrfs-progs-5.9/props.c: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 label[BTRFS_LABEL_SIZE]; data/btrfs-progs-5.9/props.c:122: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(xattr_name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN); data/btrfs-progs-5.9/props.c:123: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(xattr_name + XATTR_BTRFS_PREFIX_LEN, name, strlen(name)); data/btrfs-progs-5.9/qgroup.c:932:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[100]; data/btrfs-progs-5.9/qgroup.c:941:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(tmp, "%llu/%llu", data/btrfs-progs-5.9/qgroup.c:973:11: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. len += sprintf(tmp, "%llu/%llu", data/btrfs-progs-5.9/qgroup.c:985:11: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. len += sprintf(tmp, "%llu/%llu", data/btrfs-progs-5.9/qgroup.c:1387: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(out->qgroups, i->qgroups, pos * s); data/btrfs-progs-5.9/qgroup.c:1388: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(out->qgroups + pos + n, i->qgroups + pos, data/btrfs-progs-5.9/quick-test.c:65:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "string-%d", num); data/btrfs-progs-5.9/quick-test.c:148:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "string-%d", num); data/btrfs-progs-5.9/random-test.c:65: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]; data/btrfs-progs-5.9/random-test.c:69:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "str-%llu\n", (unsigned long long)key.objectid); data/btrfs-progs-5.9/random-test.c:91: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]; data/btrfs-progs-5.9/random-test.c:96:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "str-%llu\n", (unsigned long long)key.objectid); data/btrfs-progs-5.9/random-test.c:372:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). iterations = atoi(av[i+1]); data/btrfs-progs-5.9/random-test.c:375:22: [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). init_fill_count = atoi(av[i+1]); data/btrfs-progs-5.9/repair.c:41: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(&corrupt->key, first_key, sizeof(*first_key)); data/btrfs-progs-5.9/send.h:51: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 magic[sizeof(BTRFS_SEND_STREAM_MAGIC)]; data/btrfs-progs-5.9/tests/fssum.c:52: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. unsigned char out[CS_SIZE]; data/btrfs-progs-5.9/tests/fssum.c:80:1: [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[65536]; data/btrfs-progs-5.9/tests/fssum.c:159: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[65536]; data/btrfs-progs-5.9/tests/fssum.c:218:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(s + i * 2, "%02x", dst->out[i]); data/btrfs-progs-5.9/tests/fssum.c:333:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(dst, "\\%02x", (unsigned char)*src); data/btrfs-progs-5.9/tests/fssum.c:647: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 flagstring[sizeof(flchar)]; data/btrfs-progs-5.9/tests/fssum.c:691:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). out_fp = fopen(optarg, "w"); data/btrfs-progs-5.9/tests/fssum.c:699:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). in_fp = fopen(optarg, "r"); data/btrfs-progs-5.9/tests/fssum.c:785:7: [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(path, O_RDONLY); data/btrfs-progs-5.9/btrfs-corrupt-block.c:1217:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(field, optarg, FIELD_BUF_LEN); data/btrfs-progs-5.9/btrfs-crc.c:75:41: [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). printf("%12u - %s\n", crc32c(~1, str, strlen(str)), str); data/btrfs-progs-5.9/btrfs-list.c:415:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ri->name, name, name_len); data/btrfs-progs-5.9/btrfs-list.c:487:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ri->name, name, name_len); data/btrfs-progs-5.9/btrfs-list.c:582: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). add_len = strlen(found->path); data/btrfs-progs-5.9/btrfs-list.c:668: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). ri->path = malloc(strlen(ri->name) + strlen(args.name) + 1); data/btrfs-progs-5.9/btrfs-list.c:668: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). ri->path = malloc(strlen(ri->name) + strlen(args.name) + 1); data/btrfs-progs-5.9/btrfs-list.c:827: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). full = malloc(strlen(dirid) + strlen(name) + 1); data/btrfs-progs-5.9/btrfs-list.c:827:32: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). full = malloc(strlen(dirid) + strlen(name) + 1); data/btrfs-progs-5.9/btrfs-list.c:1138:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int add_len = strlen(p); data/btrfs-progs-5.9/btrfs-list.c:1139:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen(ri->full_path); data/btrfs-progs-5.9/btrfs-list.c:1355:4: [1] (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 character. strcpy(tstr, "-"); data/btrfs-progs-5.9/btrfs-list.c:1360:4: [1] (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 character. strcpy(uuidparse, "-"); data/btrfs-progs-5.9/btrfs-list.c:1367:4: [1] (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 character. strcpy(uuidparse, "-"); data/btrfs-progs-5.9/btrfs-list.c:1374:4: [1] (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 character. strcpy(uuidparse, "-"); data/btrfs-progs-5.9/btrfs-list.c:1459:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(btrfs_list_columns[i].name); data/btrfs-progs-5.9/btrfs-list.c:1461:5: [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(barrier, "-"); data/btrfs-progs-5.9/btrfs.c:39: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). size_t len = strlen(prefix); data/btrfs-progs-5.9/check/main.c:7158:26: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (nr_entries <= 1 && !mismatch) data/btrfs-progs-5.9/check/mode-common.c:444:43: [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). ret = btrfs_mkdir(trans, root, dir_name, strlen(dir_name), data/btrfs-progs-5.9/check/mode-lowmem.c:1175: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). if (index != 0 || len != strlen("..") || data/btrfs-progs-5.9/check/mode-lowmem.c:5063:41: [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). ret = find_inode_ref(root, &key, "..", strlen(".."), &index); data/btrfs-progs-5.9/cmds/device.c:537:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path, (char *)di_args[i].path, data/btrfs-progs-5.9/cmds/filesystem-du.c:429:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int ret, len = strlen(filename); data/btrfs-progs-5.9/cmds/filesystem-usage.c:1177: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). (int)(20 - strlen(description) - strlen(r_mode)), "", data/btrfs-progs-5.9/cmds/filesystem-usage.c:1177:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (int)(20 - strlen(description) - strlen(r_mode)), "", data/btrfs-progs-5.9/cmds/filesystem-usage.c:1184:14: [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)(20 - strlen("Unallocated")), "", data/btrfs-progs-5.9/cmds/filesystem-usage.c:1192:14: [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)(20 - strlen("Device size")), "", data/btrfs-progs-5.9/cmds/filesystem-usage.c:1195:14: [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)(20 - strlen("Device slack")), "", data/btrfs-progs-5.9/cmds/filesystem.c:124: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). int search_len = strlen(search); data/btrfs-progs-5.9/cmds/filesystem.c:145: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). int search_len = strlen(search); data/btrfs-progs-5.9/cmds/filesystem.c:1091: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(amount); data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:161:33: [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 (strncasecmp("BTRFS_", str, strlen("BTRFS_")) == 0) data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:162:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). str += strlen("BTRFS_"); data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:165:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen(tn[i].name); data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:178:32: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strncasecmp("_TREE", str, strlen("_TREE")) == 0) data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:179:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). str += strlen("_TREE"); data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:181: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). if (strncasecmp("_OBJECTID", str, strlen("_OBJECTID")) == 0) data/btrfs-progs-5.9/cmds/inspect-dump-tree.c:182:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). str += strlen("_OBJECTID"); data/btrfs-progs-5.9/cmds/property.c:82: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). tmp = malloc(strlen(object) + 5); data/btrfs-progs-5.9/cmds/property.c:88:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (tmp[strlen(tmp) - 1] != '/') data/btrfs-progs-5.9/cmds/property.c:89:3: [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(tmp, "/"); data/btrfs-progs-5.9/cmds/receive-dump.c:57: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). size_t path_len = strlen(path); data/btrfs-progs-5.9/cmds/receive.c:310:14: [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). root_len = strlen(rctx->full_root_path); data/btrfs-progs-5.9/cmds/receive.c:311: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). sub_len = strlen(parent_subvol->path); data/btrfs-progs-5.9/cmds/receive.c:758: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). size_t root_len = strlen(rctx->full_root_path); data/btrfs-progs-5.9/cmds/receive.c:759: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). size_t sub_len = strlen(si->path); data/btrfs-progs-5.9/cmds/receive.c:1148:46: [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). rctx->dest_dir_path = dest_dir_full_path + strlen(rctx->root_path); data/btrfs-progs-5.9/cmds/receive.c:1311:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(optarg)); data/btrfs-progs-5.9/cmds/receive.c:1328:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(optarg)); data/btrfs-progs-5.9/cmds/replace.c:235:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *)start_args.start.srcdev_name, srcdev, data/btrfs-progs-5.9/cmds/replace.c:260:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *)start_args.start.tgtdev_name, dstdev, data/btrfs-progs-5.9/cmds/restore.c:1555:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(argv[optind + 1]) >= PATH_MAX) { data/btrfs-progs-5.9/cmds/restore.c:1560:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dir_name, argv[optind + 1], sizeof dir_name); data/btrfs-progs-5.9/cmds/restore.c:1564: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(dir_name); data/btrfs-progs-5.9/cmds/scrub.c:371:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(datafile, fn_base, end); data/btrfs-progs-5.9/cmds/scrub.c:372: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). ret = strlen(datafile); data/btrfs-progs-5.9/cmds/scrub.c:378:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(datafile + ret + 1, fn_local, end - ret - 1); data/btrfs-progs-5.9/cmds/scrub.c:379: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). ret = strlen(datafile); data/btrfs-progs-5.9/cmds/scrub.c:386:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(datafile + ret + 1, fn_tmp, end - ret - 1); data/btrfs-progs-5.9/cmds/scrub.c:387: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). ret = strlen(datafile); data/btrfs-progs-5.9/cmds/scrub.c:520:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). avail = read(fd, l + old_avail, sizeof(l) - old_avail); data/btrfs-progs-5.9/cmds/scrub.c:783:33: [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 (scrub_write_buf(fd, fsid, strlen(fsid)) || data/btrfs-progs-5.9/cmds/scrub.c:1074: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). for (i = 1; i < strlen(path); ++i) { data/btrfs-progs-5.9/cmds/scrub.c:1347:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(addr.sun_path, sock_path, sizeof(addr.sun_path) - 1); data/btrfs-progs-5.9/cmds/send.c:550:46: [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). error("output file path too long (%zu)", strlen(optarg)); data/btrfs-progs-5.9/cmds/subvolume.c:164: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(newname); data/btrfs-progs-5.9/cmds/subvolume.c:805: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(newname); data/btrfs-progs-5.9/cmds/subvolume.c:1148:3: [1] (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 character. strcpy(uuidparse, "-"); data/btrfs-progs-5.9/cmds/subvolume.c:1154:3: [1] (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 character. strcpy(uuidparse, "-"); data/btrfs-progs-5.9/cmds/subvolume.c:1160:3: [1] (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 character. strcpy(uuidparse, "-"); data/btrfs-progs-5.9/cmds/subvolume.c:1171:3: [1] (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 character. strcpy(tstr, "-"); data/btrfs-progs-5.9/common/device-scan.c:75:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(input) == (BTRFS_UUID_UNPARSED_SIZE - 1) && data/btrfs-progs-5.9/common/format-output.c:244: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). len = strlen(row->out_text); data/btrfs-progs-5.9/common/help.c:42: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). int len = strlen(argv0_buf); data/btrfs-progs-5.9/common/help.c:50:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(argv0_buf, argv[0], sizeof(argv0_buf)); data/btrfs-progs-5.9/common/path-utils.c:299:44: [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 (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) { data/btrfs-progs-5.9/common/path-utils.c:352:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, src, n); data/btrfs-progs-5.9/common/path-utils.c:386: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). size_t len = strlen(src); data/btrfs-progs-5.9/common/send-stream.c:61:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rbytes = read(sctx->fd, buf + pos, len - pos); data/btrfs-progs-5.9/common/send-utils.c:302:3: [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/btrfs-progs-5.9/common/send-utils.c:323: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). len = strlen(ino_lookup_arg.name); data/btrfs-progs-5.9/common/send-utils.c:332:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(path, (char *)(backref_item + 1), data/btrfs-progs-5.9/common/send-utils.c:755: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). int p1_len = strlen(p1); data/btrfs-progs-5.9/common/send-utils.c:756: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). int p2_len = strlen(p2); data/btrfs-progs-5.9/common/send-utils.c:772: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). int p1_len = strlen(p1); data/btrfs-progs-5.9/common/send-utils.c:773: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). int p2_len = strlen(p2); data/btrfs-progs-5.9/common/send-utils.c:774: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). int p3_len = strlen(p3); data/btrfs-progs-5.9/common/string-table.c:105:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(tab->cells[idx]) - 1; data/btrfs-progs-5.9/common/string-table.c:119: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). if (!cell || !strlen(cell)) { data/btrfs-progs-5.9/common/task-utils.c:131:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(info->periodic.timer_fd, &missed, sizeof (missed)); data/btrfs-progs-5.9/common/utils.c:314:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(where, mnt->mnt_dir, size); data/btrfs-progs-5.9/common/utils.c:472: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). int len = strlen(input); data/btrfs-progs-5.9/common/utils.c:714:32: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const char *ptr_src_end = p + strlen(p); data/btrfs-progs-5.9/common/utils.c:1270: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). len = strlen(ent->mnt_dir); data/btrfs-progs-5.9/common/utils.c:1578: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). int len = strlen(mnt); data/btrfs-progs-5.9/common/utils.c:1617:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, rand_seed, sizeof(rand_seed)); data/btrfs-progs-5.9/common/utils.c:1750: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). maxlen += strlen(btrfs_raid_array[i].raid_name) + 2; data/btrfs-progs-5.9/convert/main.c:822:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(name), BTRFS_FT_REG_FILE, NULL, 1, 0); data/btrfs-progs-5.9/convert/main.c:1653: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). image_name, strlen(image_name), 0); data/btrfs-progs-5.9/convert/main.c:1820: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(optarg) >= BTRFS_LABEL_SIZE) { data/btrfs-progs-5.9/convert/source-ext2.c:506: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). name_len = strlen(xattr_prefix_table[name_index]) + data/btrfs-progs-5.9/convert/source-ext2.c:522:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(namebuf, xattr_prefix_table[name_index], XATTR_NAME_MAX); data/btrfs-progs-5.9/convert/source-ext2.c:523:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(namebuf, EXT2_EXT_ATTR_NAME(entry), entry->e_name_len); data/btrfs-progs-5.9/kernel-shared/file.c:328:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read; data/btrfs-progs-5.9/kernel-shared/inode.c:599: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(base); data/btrfs-progs-5.9/kernel-shared/print-tree.c:172:4: [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(ret, "|"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:177:4: [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(ret, "|"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:427:4: [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(ret, "|"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:432:3: [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(ret, "|"); data/btrfs-progs-5.9/kernel-shared/print-tree.c:896:4: [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(dst, "|"); \ data/btrfs-progs-5.9/kernel-shared/print-tree.c:1194:4: [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(ret, "|"); data/btrfs-progs-5.9/libbtrfsutil/python/module.c:104: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). if ((size_t)length != strlen(tmp)) { data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:223: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). lookup_len = strlen(lookup.name); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:642: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(path); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:665: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(basename); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:729: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(name); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1166: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(name); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1278: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(name); data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1395: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). lookup.name, strlen(lookup.name), data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1414:44: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return build_subvol_path(iter, args.name, strlen(args.name), data/btrfs-progs-5.9/libbtrfsutil/subvolume.c:1415: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). args.path, strlen(args.path), path_len_ret); data/btrfs-progs-5.9/mkfs/main.c:399: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). int len = strlen(input); data/btrfs-progs-5.9/mkfs/main.c:474:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &rotational, 1) < 1) { data/btrfs-progs-5.9/mkfs/main.c:745:50: [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). ret = btrfs_insert_inode_ref(trans, root, name, strlen(name), ino, ino, data/btrfs-progs-5.9/mkfs/main.c:1069:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fs_uuid, optarg, data/btrfs-progs-5.9/mkfs/rootdir.c:69: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). name_len = strlen(name); data/btrfs-progs-5.9/mkfs/rootdir.c:190: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). dir_inode_size += strlen(cur_file->d_name); data/btrfs-progs-5.9/mkfs/rootdir.c:248: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). cur_name_len = strlen(cur_name); data/btrfs-progs-5.9/props.c:117:47: [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). xattr_name = malloc(XATTR_BTRFS_PREFIX_LEN + strlen(name) + 1); data/btrfs-progs-5.9/props.c:123:52: [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(xattr_name + XATTR_BTRFS_PREFIX_LEN, name, strlen(name)); data/btrfs-progs-5.9/props.c:124: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). xattr_name[XATTR_BTRFS_PREFIX_LEN + strlen(name)] = '\0'; data/btrfs-progs-5.9/props.c:129:43: [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). sret = fsetxattr(fd, xattr_name, value, strlen(value), 0); data/btrfs-progs-5.9/qgroup.c:299:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(btrfs_qgroup_columns[i].name); data/btrfs-progs-5.9/qgroup.c:302: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). len = max_len - strlen(btrfs_qgroup_columns[i].name); data/btrfs-progs-5.9/qgroup.c:306: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). len = max_len - strlen(btrfs_qgroup_columns[i].name); data/btrfs-progs-5.9/qgroup.c:309:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(btrfs_qgroup_columns[i].name); data/btrfs-progs-5.9/qgroup.c:944: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). len = strlen(tmp); data/btrfs-progs-5.9/qgroup.c:949: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). len = strlen(pretty_size_mode(bq->info.referenced, unit_mode)); data/btrfs-progs-5.9/qgroup.c:954: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). len = strlen(pretty_size_mode(bq->info.exclusive, unit_mode)); data/btrfs-progs-5.9/qgroup.c:959: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). len = strlen(pretty_size_mode(bq->limit.max_referenced, data/btrfs-progs-5.9/qgroup.c:965: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). len = strlen(pretty_size_mode(bq->limit.max_exclusive, data/btrfs-progs-5.9/random-test.c:70:50: [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). ret = btrfs_insert_item(trans, root, &key, buf, strlen(buf)); data/btrfs-progs-5.9/random-test.c:97:50: [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). ret = btrfs_insert_item(trans, root, &key, buf, strlen(buf)); data/btrfs-progs-5.9/tests/fssum.c:94:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). l = strlen(p); data/btrfs-progs-5.9/tests/fssum.c:250:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/btrfs-progs-5.9/tests/fssum.c:308:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/btrfs-progs-5.9/tests/fssum.c:325: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). char *out = alloc(strlen(in) * 3 + 1); data/btrfs-progs-5.9/tests/fssum.c:357:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len_a = strlen(a); data/btrfs-progs-5.9/tests/fssum.c:358:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len_b = strlen(b); data/btrfs-progs-5.9/tests/fssum.c:520: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). path = alloc(strlen(path_in) + strlen(namelist[i]) + 3); data/btrfs-progs-5.9/tests/fssum.c:520: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). path = alloc(strlen(path_in) + strlen(namelist[i]) + 3); data/btrfs-progs-5.9/tests/fssum.c:540:31: [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). sum_add(&meta, namelist[i], strlen(namelist[i])); data/btrfs-progs-5.9/tests/fssum.c:613:5: [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/btrfs-progs-5.9/tests/fssum.c:765: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). plen = strlen(path); data/btrfs-progs-5.9/tests/fssum.c:778:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). elen = strlen(excludes[i].path); ANALYSIS SUMMARY: Hits = 866 Lines analyzed = 122309 in approximately 3.23 seconds (37833 lines/second) Physical Source Lines of Code (SLOC) = 95293 Hits@level = [0] 1713 [1] 156 [2] 579 [3] 76 [4] 48 [5] 7 Hits@level+ = [0+] 2579 [1+] 866 [2+] 710 [3+] 131 [4+] 55 [5+] 7 Hits/KSLOC@level+ = [0+] 27.0639 [1+] 9.08776 [2+] 7.4507 [3+] 1.37471 [4+] 0.577167 [5+] 0.0734577 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.