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/nvidia-modprobe-455.23.04/nvidia-modprobe.c Examining data/nvidia-modprobe-455.23.04/option-table.h Examining data/nvidia-modprobe-455.23.04/gen-manpage-opts.c Examining data/nvidia-modprobe-455.23.04/common-utils/nvgetopt.c Examining data/nvidia-modprobe-455.23.04/common-utils/common-utils.c Examining data/nvidia-modprobe-455.23.04/common-utils/msg.c Examining data/nvidia-modprobe-455.23.04/common-utils/nvgetopt.h Examining data/nvidia-modprobe-455.23.04/common-utils/common-utils.h Examining data/nvidia-modprobe-455.23.04/common-utils/msg.h Examining data/nvidia-modprobe-455.23.04/common-utils/gen-manpage-opts-helper.c Examining data/nvidia-modprobe-455.23.04/common-utils/gen-manpage-opts-helper.h Examining data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c Examining data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.h Examining data/nvidia-modprobe-455.23.04/modprobe-utils/pci-enum.h Examining data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.h Examining data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c FINAL RESULTS: data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:590:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if ((chmod(path, mode) != 0) || data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:591:10: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. (chown(path, uid, gid) != 0)) data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:102:9: [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(result, s); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:345: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(ret, prefix); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:346:5: [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(ret, replace); data/nvidia-modprobe-455.23.04/common-utils/gen-manpage-opts-helper.c:42:13: [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(scratch, o->arg_name); data/nvidia-modprobe-455.23.04/common-utils/msg.c:231:5: [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. int vsnprintf(char *str, size_t size, const char *format, data/nvidia-modprobe-455.23.04/common-utils/msg.h:72:19: [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. len = vsnprintf((buf), current_len, (fmt), ap); \ data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:348:13: [4] (shell) execle: 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. execle(modprobe_path, "modprobe", data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:708:11: [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. ret = snprintf(path, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:743:15: [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. ret = snprintf(path, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:748:15: [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. ret = snprintf(path, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:847:15: [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. ret = snprintf(name, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:852:15: [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. ret = snprintf(name, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:875:11: [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. ret = snprintf(vgpu_dev_name, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:930:11: [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. ret = snprintf(name, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.h:107:15: [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. ret = snprintf(name, data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.h:113:15: [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. ret = snprintf(name, data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:146:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. sscanf(d->d_name, PCI_DBDF_FORMAT, data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:338:9: [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. snprintf(node_buf, sizeof(node_buf) - 1, SYSFS_PCI_BRIDGE_RESCAN_FMT, data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:382:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(p_node, PCI_DBDF_FORMAT, data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:315:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. prefix = getenv("HOME"); data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:368:9: [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(gpu_path, bridge_path) == NULL) data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:397:17: [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(tmpbuf, buf, len); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:446:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(pathname, flags, mode); data/nvidia-modprobe-455.23.04/common-utils/gen-manpage-opts-helper.c:34: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 scratch[64], *s; data/nvidia-modprobe-455.23.04/common-utils/nvgetopt.c:459:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char scratch[16]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:130: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 module_name[NV_MAX_MODULE_NAME_SIZE]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:133:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(NV_PROC_MODULES_PATH, "r"); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:163:23: [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 dev_null_fd = open("/dev/null", O_RDWR); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:176: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 soc_family_name[NV_MAX_SOC_FAMILY_NAME_SIZE]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:180:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(NV_SYS_DEVICES_SOC_FAMILY, "r"); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:210: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 modprobe_path[NV_PROC_MODPROBE_PATH_MAX]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:282:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(NV_PROC_MODPROBE_PATH, "r"); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:315:9: [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(modprobe_path, "/sbin/modprobe"); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:405: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 name[32]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:418:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(proc_path, "r"); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:490: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 path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:610: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 path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:626:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[NV_MAX_LINE_LENGTH]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:631:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(NV_PROC_DEVICES_PATH, "r"); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:694: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 path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:727: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 path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:835: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 name[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:867: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 vgpu_dev_name[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:892: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 field[32]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:904:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(cap_file_path, "r"); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:947: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 name[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:967: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 path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.h:94: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 name[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN], data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:191: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 name[SYSFS_PATH_SIZE]; data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:211:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(name, O_RDONLY); data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:258: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 name[SYSFS_PATH_SIZE]; data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:277:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(name, O_WRONLY); data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:327: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 node_buf[SYSFS_PATH_SIZE]; data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:343:15: [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). node_fd = open(node, O_WRONLY); data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:360: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 gpu_path[SYSFS_PATH_SIZE]; data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:361: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 bridge_path[PATH_MAX]; data/nvidia-modprobe-455.23.04/nvidia-modprobe.c:92: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 *cap_files[256]; data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:84: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). len += strlen(s); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:181:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (m, s, n); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:331: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 (!replace) replace = str + strlen(str); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:335:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(user, str+1, len-1); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:344: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). ret = malloc(strlen(prefix) + strlen(replace) + 1); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:344: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). ret = malloc(strlen(prefix) + strlen(replace) + 1); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:404:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = fgetc(fp); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:429: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). return (s + strlen(s)); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:615:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). for (end = ret + strlen(ret) - 1; end >= ret && isspace(*end); end--) { data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:644:11: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(string); data/nvidia-modprobe-455.23.04/common-utils/common-utils.c:715:11: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(string); data/nvidia-modprobe-455.23.04/common-utils/gen-manpage-opts-helper.c:44: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). len = strlen(o->name); data/nvidia-modprobe-455.23.04/common-utils/msg.c:275: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). z = strlen(buf); /* length of entire string */ data/nvidia-modprobe-455.23.04/common-utils/msg.c:281: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). prefix_len = strlen(prefix); data/nvidia-modprobe-455.23.04/common-utils/msg.c:328:27: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). if (local_prefix) strncpy(line, local_prefix, prefix_len); data/nvidia-modprobe-455.23.04/common-utils/msg.c:329:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(line + prefix_len, a, len - prefix_len); data/nvidia-modprobe-455.23.04/common-utils/msg.c:381: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). len = strlen(msg); data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:140:12: [1] (buffer) fscanf: 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. while (fscanf(fp, "%15s%*[^\n]\n", module_name) == 1) data/nvidia-modprobe-455.23.04/modprobe-utils/nvidia-modprobe-utils.c:667: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 (found && found[strlen(name)] == '\n') data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.c:228:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t bytes = read(fd, data_bytes, temp_size); data/nvidia-modprobe-455.23.04/modprobe-utils/pci-sysfs.h:67:33: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. #define PCI_NANOSLEEP(ts, rem) usleep((ts)->tv_sec * 1000000 + ((ts)->tv_nsec + 999) / 1000) ANALYSIS SUMMARY: Hits = 80 Lines analyzed = 4592 in approximately 0.14 seconds (32870 lines/second) Physical Source Lines of Code (SLOC) = 2585 Hits@level = [0] 51 [1] 21 [2] 36 [3] 2 [4] 19 [5] 2 Hits@level+ = [0+] 131 [1+] 80 [2+] 59 [3+] 23 [4+] 21 [5+] 2 Hits/KSLOC@level+ = [0+] 50.677 [1+] 30.9478 [2+] 22.824 [3+] 8.89749 [4+] 8.12379 [5+] 0.773694 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.