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/libdebian-installer-0.120/include/debian-installer/exec.h Examining data/libdebian-installer-0.120/include/debian-installer/hash.h Examining data/libdebian-installer-0.120/include/debian-installer/list.h Examining data/libdebian-installer-0.120/include/debian-installer/log.h Examining data/libdebian-installer-0.120/include/debian-installer/macros.h Examining data/libdebian-installer-0.120/include/debian-installer/mem.h Examining data/libdebian-installer-0.120/include/debian-installer/mem_chunk.h Examining data/libdebian-installer-0.120/include/debian-installer/package.h Examining data/libdebian-installer-0.120/include/debian-installer/package_internal.h Examining data/libdebian-installer-0.120/include/debian-installer/packages.h Examining data/libdebian-installer-0.120/include/debian-installer/packages_internal.h Examining data/libdebian-installer-0.120/include/debian-installer/parser.h Examining data/libdebian-installer-0.120/include/debian-installer/parser_rfc822.h Examining data/libdebian-installer-0.120/include/debian-installer/release.h Examining data/libdebian-installer-0.120/include/debian-installer/slist.h Examining data/libdebian-installer-0.120/include/debian-installer/slist_internal.h Examining data/libdebian-installer-0.120/include/debian-installer/string.h Examining data/libdebian-installer-0.120/include/debian-installer/system/devfs.h Examining data/libdebian-installer-0.120/include/debian-installer/system/dpkg.h Examining data/libdebian-installer-0.120/include/debian-installer/system/dpkg_internal.h Examining data/libdebian-installer-0.120/include/debian-installer/system/efi.h Examining data/libdebian-installer-0.120/include/debian-installer/system/packages.h Examining data/libdebian-installer-0.120/include/debian-installer/system/prebaseconfig.h Examining data/libdebian-installer-0.120/include/debian-installer/system/subarch.h Examining data/libdebian-installer-0.120/include/debian-installer/system/utils.h Examining data/libdebian-installer-0.120/include/debian-installer/tree.h Examining data/libdebian-installer-0.120/include/debian-installer/types.h Examining data/libdebian-installer-0.120/include/debian-installer/utils.h Examining data/libdebian-installer-0.120/include/debian-installer.h Examining data/libdebian-installer-0.120/src/exec.c Examining data/libdebian-installer-0.120/src/hash.c Examining data/libdebian-installer-0.120/src/list.c Examining data/libdebian-installer-0.120/src/log.c Examining data/libdebian-installer-0.120/src/mem.c Examining data/libdebian-installer-0.120/src/mem_chunk.c Examining data/libdebian-installer-0.120/src/package.c Examining data/libdebian-installer-0.120/src/package_parser.c Examining data/libdebian-installer-0.120/src/packages.c Examining data/libdebian-installer-0.120/src/packages_parser.c Examining data/libdebian-installer-0.120/src/parser.c Examining data/libdebian-installer-0.120/src/parser_rfc822.c Examining data/libdebian-installer-0.120/src/release.c Examining data/libdebian-installer-0.120/src/slist.c Examining data/libdebian-installer-0.120/src/string.c Examining data/libdebian-installer-0.120/src/system/devfs.c Examining data/libdebian-installer-0.120/src/system/dpkg.c Examining data/libdebian-installer-0.120/src/system/efi.c Examining data/libdebian-installer-0.120/src/system/packages.c Examining data/libdebian-installer-0.120/src/system/prebaseconfig.c Examining data/libdebian-installer-0.120/src/system/subarch-arm-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-arm64-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-armeb-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-generic.c Examining data/libdebian-installer-0.120/src/system/subarch-m68k-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-mips-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-riscv64-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-sh4-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-sparc-linux.c Examining data/libdebian-installer-0.120/src/system/subarch-x86-linux.c Examining data/libdebian-installer-0.120/src/system/utils.c Examining data/libdebian-installer-0.120/src/tree.c Examining data/libdebian-installer-0.120/src/utils.c Examining data/libdebian-installer-0.120/test/main.c Examining data/libdebian-installer-0.120/test/test_exec.c Examining data/libdebian-installer-0.120/test/test_exec.h Examining data/libdebian-installer-0.120/test/test_hash.c Examining data/libdebian-installer-0.120/test/test_hash.h Examining data/libdebian-installer-0.120/test/test_system_packages.c Examining data/libdebian-installer-0.120/test/test_system_packages.h FINAL RESULTS: data/libdebian-installer-0.120/include/debian-installer/log.h:75:92: [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. void di_log (di_log_level_flags log_level, const char *format, ...) __attribute__ ((format(printf,2,3))); data/libdebian-installer-0.120/include/debian-installer/string.h:53:27: [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, 3, 4))) data/libdebian-installer-0.120/include/debian-installer/system/prebaseconfig.h:36:103: [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. int di_system_prebaseconfig_append (const char *udeb, const char *format, ...) __attribute__ ((format(printf,2,3))); data/libdebian-installer-0.120/include/debian-installer/system/prebaseconfig.h:42:96: [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. int di_prebaseconfig_append (const char *udeb, const char *format, ...) __attribute__ ((format(printf,2,3),deprecated)); data/libdebian-installer-0.120/src/exec.c:124:7: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp (path, (char *const *) argv); data/libdebian-installer-0.120/src/exec.c:128:7: [4] (shell) execv: 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. execv (path, (char *const *) argv); data/libdebian-installer-0.120/src/log.c:96: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 (level_prefix, prefix); data/libdebian-installer-0.120/src/log.c:97: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 (level_prefix, log_level & ALERT_LEVELS ? " **: " : ": "); data/libdebian-installer-0.120/src/log.c:113: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 (buf, message); data/libdebian-installer-0.120/src/log.c:142: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 (buf, message); data/libdebian-installer-0.120/src/log.c:224:3: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf (buf, sizeof (buf), format, args); data/libdebian-installer-0.120/src/package_parser.c:348:7: [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 (value.string, d->ptr->package); data/libdebian-installer-0.120/src/string.c:39:12: [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. retval = vsnprintf (str + len, size - len, format, ap); data/libdebian-installer-0.120/src/system/dpkg.c:150:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (infodir_rest, tmpdirent->d_name); data/libdebian-installer-0.120/src/system/dpkg.c:151:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (tmpdir_rest, tmpdirent->d_name); data/libdebian-installer-0.120/src/system/efi.c:29:23: [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. int efivars_access = access("/sys/firmware/efi/efivars", R_OK); data/libdebian-installer-0.120/src/system/efi.c:30:20: [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. int vars_access = access("/sys/firmware/efi/vars", R_OK); data/libdebian-installer-0.120/src/system/efi.c:34:13: [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. int ret = access("/var/lib/partman/ignore_uefi", R_OK); data/libdebian-installer-0.120/src/system/prebaseconfig.c:35:7: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. if (snprintf (path, sizeof (path), DI_SYSTEM_PREBASECONFIG_DIR "/%s", udeb) == -1) data/libdebian-installer-0.120/src/system/prebaseconfig.c:44:3: [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(fp, format, ap); data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:58:7: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!system) data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:72:24: [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. ret = regexec(&preg, system, 0, NULL, 0); data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:97: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/libdebian-installer-0.120/src/system/subarch-sparc-linux.c:45:12: [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. is_gpt = access("/sys/firmware/devicetree/base/packages/disk-label/gpt", F_OK) != -1; data/libdebian-installer-0.120/src/exec.c:259: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 (path)) data/libdebian-installer-0.120/include/debian-installer/release.h:58:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *sum[2]; /**< checksums, currently md5 and sha256 */ data/libdebian-installer-0.120/src/exec.c:44: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 line[MAXLINE]; data/libdebian-installer-0.120/src/exec.c:91:12: [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). temp = open ("/dev/null", O_RDWR); data/libdebian-installer-0.120/src/log.c:61: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[16]; data/libdebian-installer-0.120/src/log.c: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 buf[1280]; data/libdebian-installer-0.120/src/log.c:121: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[1280]; data/libdebian-installer-0.120/src/log.c:122:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char ident_buf[128]; data/libdebian-installer-0.120/src/log.c:219: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[1024]; data/libdebian-installer-0.120/src/mem_chunk.c:68: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 mem[MEM_AREA_SIZE]; /**< the mem array from which atoms get allocated data/libdebian-installer-0.120/src/package_parser.c:347:9: [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 (value.string, ", "); data/libdebian-installer-0.120/src/package_parser.c:493: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 value_buf[128]; data/libdebian-installer-0.120/src/parser.c:101: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 value_buf[32]; data/libdebian-installer-0.120/src/parser_rfc822.c:219: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). if ((fd = open (file, O_RDONLY)) < 0) data/libdebian-installer-0.120/src/parser_rfc822.c:259: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 tmpfile[PATH_MAX]; data/libdebian-installer-0.120/src/parser_rfc822.c:259:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). char tmpfile[PATH_MAX]; data/libdebian-installer-0.120/src/parser_rfc822.c:264:5: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tmpfile[0] = '\0'; data/libdebian-installer-0.120/src/parser_rfc822.c:269:15: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). snprintf (tmpfile, sizeof (tmpfile), "%s.tmp", file); data/libdebian-installer-0.120/src/parser_rfc822.c:269:32: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). snprintf (tmpfile, sizeof (tmpfile), "%s.tmp", file); data/libdebian-installer-0.120/src/parser_rfc822.c:270:9: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen (tmpfile, "w"); data/libdebian-installer-0.120/src/parser_rfc822.c:270:16: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). f = fopen (tmpfile, "w"); data/libdebian-installer-0.120/src/parser_rfc822.c:293:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if (*tmpfile) data/libdebian-installer-0.120/src/parser_rfc822.c:296:17: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if (rename (tmpfile, file)) data/libdebian-installer-0.120/src/release.c:168: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_sum, buf_filename[129]; data/libdebian-installer-0.120/src/string.c:50:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return memcpy (string, s, n); data/libdebian-installer-0.120/src/system/devfs.c:142: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 (buf, "/dev/"); data/libdebian-installer-0.120/src/system/devfs.c:214:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char ret[256]; data/libdebian-installer-0.120/src/system/dpkg.c:77: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[PATH_MAX]; data/libdebian-installer-0.120/src/system/dpkg.c:78: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. const char *real_argv[argc + 2]; data/libdebian-installer-0.120/src/system/dpkg.c:102:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[PATH_MAX]; data/libdebian-installer-0.120/src/system/dpkg.c:103: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_infodir[PATH_MAX] = { '\0' }; data/libdebian-installer-0.120/src/system/dpkg.c:104: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_tmpdir[PATH_MAX] = DI_SYSTEM_DPKG_TMPCONTROLDIR; data/libdebian-installer-0.120/src/system/dpkg.c:183: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[PATH_MAX]; data/libdebian-installer-0.120/src/system/prebaseconfig.c:31: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[128]; data/libdebian-installer-0.120/src/system/prebaseconfig.c:38: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). if ((fp = fopen (path, "a")) == NULL) data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:118:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). model = fopen("/proc/device-tree/model", "r"); data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:130: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 line[1024]; data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:134: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). cpuinfo = fopen("/proc/cpuinfo", "r"); data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:159: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 entry[256]; data/libdebian-installer-0.120/src/system/subarch-armeb-linux.c:22: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 line[1024]; data/libdebian-installer-0.120/src/system/subarch-armeb-linux.c: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 entry[256]; data/libdebian-installer-0.120/src/system/subarch-armeb-linux.c:27: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). cpuinfo = fopen("/proc/cpuinfo", "r"); data/libdebian-installer-0.120/src/system/subarch-m68k-linux.c:38: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 line[1024]; data/libdebian-installer-0.120/src/system/subarch-m68k-linux.c:39: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 model[256]; data/libdebian-installer-0.120/src/system/subarch-m68k-linux.c:43: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). file = fopen("/proc/hardware", "r"); data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:34: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[BUFFER_LENGTH]; data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:39: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). file = fopen("/proc/cpuinfo", "r"); data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.c:54: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 line[1024]; data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.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 cpuinfo_platform[256], cpuinfo_machine[256], cpuinfo_generation[256]; data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.c:58: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). cpuinfo = fopen("/proc/cpuinfo", "r"); data/libdebian-installer-0.120/src/system/subarch-sh4-linux.c: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 line[1024]; data/libdebian-installer-0.120/src/system/subarch-sh4-linux.c: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 entry[256]; data/libdebian-installer-0.120/src/system/subarch-sh4-linux.c:28: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). cpuinfo = fopen("/proc/cpuinfo", "r"); data/libdebian-installer-0.120/src/system/subarch-sparc-linux.c:39: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[BUFFER_LENGTH]; data/libdebian-installer-0.120/src/system/subarch-sparc-linux.c:47:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). file = fopen("/proc/cpuinfo", "r"); data/libdebian-installer-0.120/src/system/subarch-x86-linux.c:93: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/mem", O_RDONLY); data/libdebian-installer-0.120/src/system/subarch-x86-linux.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(p, mmp + mmoffset, len); data/libdebian-installer-0.120/test/test_exec.c:47: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(outbuf + outlen, buf, len); data/libdebian-installer-0.120/test/test_hash.c:29:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str[KEY_VALUE_NBR][STRING_MAX_LENGTH]; data/libdebian-installer-0.120/include/debian-installer/parser.h:107:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). di_parser_fields_function_read *read; /**< function for reading a field */ data/libdebian-installer-0.120/include/debian-installer/parser.h:116:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define DI_PARSER_FIELDINFO(name, read, write, integer) \ data/libdebian-installer-0.120/include/debian-installer/parser.h:117:34: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { { name, sizeof (name) - 1 }, read, write, integer } data/libdebian-installer-0.120/src/exec.c:184: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). size_t len = strlen (line); data/libdebian-installer-0.120/src/log.c:114: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 (buf, "\n"); data/libdebian-installer-0.120/src/log.c:129:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (ident_buf, user_data, sizeof (ident_buf)); data/libdebian-installer-0.120/src/log.c:143: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 (buf, "\n"); data/libdebian-installer-0.120/src/package.c:124: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). end = string + strlen (string); data/libdebian-installer-0.120/src/package.c:181: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). const di_rstring temp = { (char *) text, strlen (text) }; data/libdebian-installer-0.120/src/package_parser.c:334: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 size = strlen (d->ptr->package); data/libdebian-installer-0.120/src/package_parser.c:399: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). value.size = strlen (p->short_description) + strlen (p->description) + 1; data/libdebian-installer-0.120/src/package_parser.c:399: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). value.size = strlen (p->short_description) + strlen (p->description) + 1; data/libdebian-installer-0.120/src/package_parser.c:411: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). value.size = strlen (p->short_description); data/libdebian-installer-0.120/src/package_parser.c:457: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). value.size = strlen(value.string); data/libdebian-installer-0.120/src/packages.c:129: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). size = strlen (name); data/libdebian-installer-0.120/src/parser.c:162: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). value.size = strlen (*f); data/libdebian-installer-0.120/src/parser_rfc822.c:157:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fip->read (&act, fip, NULL, &value_string, user_data); data/libdebian-installer-0.120/src/parser_rfc822.c:176:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fip->read (&act, fip, &field_modifier_string, &value_string, user_data); data/libdebian-installer-0.120/src/parser_rfc822.c:197:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fip->read (&act, fip, &field_modifier_string, &value_string, user_data); data/libdebian-installer-0.120/src/release.c:180:11: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. ret = sscanf (begin, "%ms %zu %128s", &buf_sum, &buf_size, buf_filename); data/libdebian-installer-0.120/src/release.c:184: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). di_rstring key = { buf_filename, strlen (buf_filename) }; data/libdebian-installer-0.120/src/release.c:190:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). file->key.size = strlen (buf_filename); data/libdebian-installer-0.120/src/string.c:36:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen (str); data/libdebian-installer-0.120/src/system/dpkg.c:147: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 (tmpdirent->d_name) > (tmpdir_rest_len < infodir_rest_len ? tmpdir_rest_len : infodir_rest_len)) data/libdebian-installer-0.120/src/system/packages.c:99: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). size_t len_subarchitecture = strlen (subarchitecture); data/libdebian-installer-0.120/src/system/packages.c:105: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). end = begin + strlen (begin); data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:147:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(entry, pos, entry_len); data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:178:4: [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(map_hardware[i].entry))) data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:198: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). uname_release_len = strlen(sysinfo.release); data/libdebian-installer-0.120/src/system/subarch-arm-linux.c:202: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). size_t subarch_len = strlen (supported_generic_subarches[i]); data/libdebian-installer-0.120/src/system/subarch-armeb-linux.c:40:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(entry, pos, sizeof(entry)); data/libdebian-installer-0.120/src/system/subarch-armeb-linux.c:50:4: [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(map_hardware[i].entry))) data/libdebian-installer-0.120/src/system/subarch-m68k-linux.c:56:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(model, pos, sizeof(model)); data/libdebian-installer-0.120/src/system/subarch-m68k-linux.c:66:4: [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(map_model[i].model))) data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:47: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). if (!strncmp(buf, "system type", strlen("system type"))) data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:49:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!strncmp(buf, "cpu model", strlen("cpu model"))) data/libdebian-installer-0.120/src/system/subarch-mips-linux.c:51:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!strncmp(buf, "isa", strlen("isa"))) data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.c:45:39: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!strncasecmp(map->entry, entry, strlen(map->entry))) data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.c:69:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cpuinfo_platform, pos, sizeof(cpuinfo_platform)); data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.c:72:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cpuinfo_machine, pos, sizeof(cpuinfo_machine)); data/libdebian-installer-0.120/src/system/subarch-powerpc-linux.c:75:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cpuinfo_generation, pos, sizeof(cpuinfo_generation)); data/libdebian-installer-0.120/src/system/subarch-sh4-linux.c:41:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(entry, pos, sizeof(entry)); data/libdebian-installer-0.120/src/system/subarch-sh4-linux.c:51:4: [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(map_hardware[i].entry))) data/libdebian-installer-0.120/src/system/subarch-sparc-linux.c:25:65: [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(subarch_map[i].cpuinfo_type, cpuinfo_type, strlen(subarch_map[i].cpuinfo_type))) data/libdebian-installer-0.120/src/system/subarch-sparc-linux.c:55: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 (!strncmp(buf, "type", strlen("type"))) data/libdebian-installer-0.120/src/system/subarch-x86-linux.c:142: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). bp += strlen(bp); data/libdebian-installer-0.120/src/system/subarch-x86-linux.c:151: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(bp); data/libdebian-installer-0.120/src/system/subarch-x86-linux.c:282:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(map_manufacturer[i].entry))) data/libdebian-installer-0.120/test/test_exec.c:58: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). ck_assert_int_eq(outlen, strlen(expected_output)); data/libdebian-installer-0.120/test/test_hash.c:18: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). size = strlen (name); ANALYSIS SUMMARY: Hits = 133 Lines analyzed = 8570 in approximately 0.30 seconds (28379 lines/second) Physical Source Lines of Code (SLOC) = 4999 Hits@level = [0] 23 [1] 50 [2] 58 [3] 1 [4] 24 [5] 0 Hits@level+ = [0+] 156 [1+] 133 [2+] 83 [3+] 25 [4+] 24 [5+] 0 Hits/KSLOC@level+ = [0+] 31.2062 [1+] 26.6053 [2+] 16.6033 [3+] 5.001 [4+] 4.80096 [5+] 0 Symlinks skipped = 8 (--allowlink overrides but see doc for security issue) 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.