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/discover-2.1.2/sysdeps/stub/stubs.c Examining data/discover-2.1.2/sysdeps/linux/pcmcia.c Examining data/discover-2.1.2/sysdeps/linux/scsi.c Examining data/discover-2.1.2/sysdeps/linux/pcmcia/ciscode.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/ds.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/cs_types.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/cs.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/ss.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/ftl.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/cisreg.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/mem_op.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/memory.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/bulkmem.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/cistpl.h Examining data/discover-2.1.2/sysdeps/linux/pcmcia/version.h Examining data/discover-2.1.2/sysdeps/linux/ata.c Examining data/discover-2.1.2/sysdeps/linux/pci.c Examining data/discover-2.1.2/sysdeps/linux/usb.c Examining data/discover-2.1.2/portability/stdbool.h Examining data/discover-2.1.2/portability/mkdtemp.c Examining data/discover-2.1.2/portability/mkstemp.h Examining data/discover-2.1.2/portability/alloca.c Examining data/discover-2.1.2/portability/strsep.h Examining data/discover-2.1.2/portability/mkstemp.c Examining data/discover-2.1.2/portability/alloca.h Examining data/discover-2.1.2/portability/strsep.c Examining data/discover-2.1.2/portability/mkdtemp.h Examining data/discover-2.1.2/lib/curl.c Examining data/discover-2.1.2/lib/core.c Examining data/discover-2.1.2/lib/conf.c Examining data/discover-2.1.2/lib/version-cmp.c Examining data/discover-2.1.2/lib/busclass-xml.c Examining data/discover-2.1.2/lib/sysdep.c Examining data/discover-2.1.2/lib/utils.c Examining data/discover-2.1.2/lib/vendor-xml.c Examining data/discover-2.1.2/lib/device.c Examining data/discover-2.1.2/lib/url-xml.c Examining data/discover-2.1.2/lib/load-url.c Examining data/discover-2.1.2/lib/stack.c Examining data/discover-2.1.2/lib/device-xml.c Examining data/discover-2.1.2/discover-xml/discover-xml.c Examining data/discover-2.1.2/buildtools/gettext.h Examining data/discover-2.1.2/include/discover/discover-conf.h Examining data/discover-2.1.2/include/discover/device.h Examining data/discover-2.1.2/include/discover/sysdep.h Examining data/discover-2.1.2/include/discover/stack.h Examining data/discover-2.1.2/include/discover/url-xml.h Examining data/discover-2.1.2/include/discover/curl.h Examining data/discover-2.1.2/include/discover/discover-xml.h Examining data/discover-2.1.2/include/discover/load-url.h Examining data/discover-2.1.2/include/discover/discover.h Examining data/discover-2.1.2/include/discover/utils.h Examining data/discover-2.1.2/tests/xml.c Examining data/discover-2.1.2/tests/device.c Examining data/discover-2.1.2/tests/main.c Examining data/discover-2.1.2/tests/test.h Examining data/discover-2.1.2/discover/discover.c FINAL RESULTS: data/discover-2.1.2/lib/conf.c:413:13: [5] (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. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(buf, confent->d_name, sizeof(buf)); data/discover-2.1.2/discover/discover.c:469:21: [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. fprintf(stream, details->format_substring, list_text); data/discover-2.1.2/lib/core.c:88: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((*status)->message, message); data/discover-2.1.2/lib/version-cmp.c:382:17: [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(*upper, buffer1); data/discover-2.1.2/lib/version-cmp.c:386:17: [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(*lower, buffer2); data/discover-2.1.2/lib/version-cmp.c:390:17: [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(*lower, buffer1); data/discover-2.1.2/lib/version-cmp.c:394:17: [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(*upper, buffer2); data/discover-2.1.2/sysdeps/linux/ata.c:71:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path,"%s/%s", PATH_PROC_IDE, ide_link); data/discover-2.1.2/sysdeps/linux/ata.c:78:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s/driver", PATH_PROC_IDE, ide_link); data/discover-2.1.2/sysdeps/linux/ata.c:91:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s/model", PATH_PROC_IDE, ide_link); data/discover-2.1.2/sysdeps/linux/ata.c:126:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s/media", PATH_PROC_IDE, ide_link); data/discover-2.1.2/sysdeps/linux/pci.c:314:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (!access(PATH_SYS_PCI, R_OK)) data/discover-2.1.2/sysdeps/linux/pcmcia.c:99:12: [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(sscanf(s, "%d %s", &n, t) == 2){ data/discover-2.1.2/sysdeps/linux/scsi.c:152:9: [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(node->vendor, vendor); data/discover-2.1.2/sysdeps/linux/scsi.c:153:9: [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(node->model, model); data/discover-2.1.2/sysdeps/linux/usb.c:69:17: [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. sscanf(line, "P: Vendor=%s ProdID=%s Rev=%*2x.%*02x\n", data/discover-2.1.2/discover-xml/discover-xml.c:216:18: [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. while ((ch = getopt_long(argc, argv, shortopts, longopts, data/discover-2.1.2/discover/discover.c:679:18: [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. while ((ch = getopt_long(argc, argv, shortopts, longopts, data/discover-2.1.2/sysdeps/linux/pcmcia.c:119:14: [3] (tmpfile) tmpnam: Temporary file race condition (CWE-377). if((fn = tmpnam(NULL)) == NULL){ data/discover-2.1.2/discover/discover.c:55: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 format_substring[FORMAT_LENGTH+1]; data/discover-2.1.2/discover/discover.c:602:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-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[11]; /* vendorid + modelid */ data/discover-2.1.2/discover/discover.c:603:17: [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, "0x%4.4s%4.4s", data/discover-2.1.2/lib/busclass-xml.c:110:24: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. vid = (char *) attrs[i + 1]; data/discover-2.1.2/lib/busclass-xml.c:112:26: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. vname = (char *) attrs[i + 1]; data/discover-2.1.2/lib/conf.c:135:21: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. scan = (char *)attrs[i + 1]; data/discover-2.1.2/lib/conf.c:278: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. busname = (char *)attrs[i + 1]; data/discover-2.1.2/lib/conf.c:299:34: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. found_url = (char *)attrs[i + 1]; data/discover-2.1.2/lib/conf.c:387:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[512]; data/discover-2.1.2/lib/conf.c:412:13: [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(buf, "file:///" SYSCONFDIR "/discover.conf.d/"); data/discover-2.1.2/lib/device-xml.c:162:25: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. busclass = (char *)attrs[i + 1]; data/discover-2.1.2/lib/device-xml.c:165:25: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. model_id = (char *)attrs[i + 1]; data/discover-2.1.2/lib/device-xml.c:168: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. model_name = (char *)attrs[i + 1]; data/discover-2.1.2/lib/device-xml.c:171:26: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. vendor_id = (char *)attrs[i + 1]; data/discover-2.1.2/lib/device-xml.c:231:31: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. discover_class = (char *)attrs[i + 1]; data/discover-2.1.2/lib/device-xml.c:233:24: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. version = (char *)attrs[i + 1]; data/discover-2.1.2/lib/load-url.c:41: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). #define fopen gzopen data/discover-2.1.2/lib/load-url.c:57:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[4096]; data/discover-2.1.2/lib/load-url.c:84:16: [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). url_file = fopen(file_path, "r"); data/discover-2.1.2/lib/utils.c:91: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(copy, s, len); data/discover-2.1.2/lib/vendor-xml.c:113:24: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. vid = (char *) attrs[i + 1]; data/discover-2.1.2/lib/vendor-xml.c:115:26: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. vname = (char *) attrs[i + 1]; data/discover-2.1.2/lib/version-cmp.c:172: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 buffer1[MAXBUFLEN]; data/discover-2.1.2/lib/version-cmp.c:175: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 buffer2[MAXBUFLEN]; data/discover-2.1.2/lib/version-cmp.c:303:13: [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(bufptr2, "inf"); data/discover-2.1.2/portability/alloca.c:146: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 align[ALIGN_SIZE]; /* To force sizeof(header). */ data/discover-2.1.2/portability/mkdtemp.c:50: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 xtra[2] = "aa"; data/discover-2.1.2/portability/mkstemp.c:57: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 xtra[2] = "aa"; data/discover-2.1.2/portability/mkstemp.c:117: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). open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0) data/discover-2.1.2/portability/mkstemp.c:148:1: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). mkstemp(path) data/discover-2.1.2/portability/mkstemp.h:3:5: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int mkstemp(char *path); data/discover-2.1.2/sysdeps/linux/ata.c:44: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[256]; data/discover-2.1.2/sysdeps/linux/ata.c:79:27: [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/discover-2.1.2/sysdeps/linux/ata.c:92:27: [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/discover-2.1.2/sysdeps/linux/ata.c:127:27: [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/discover-2.1.2/sysdeps/linux/pci.c:73: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 file_path[_MAX_PATH_LEN]; data/discover-2.1.2/sysdeps/linux/pci.c:76:25: [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 ((devices_file = fopen(PATH_PROC_PCI, "r"))) { data/discover-2.1.2/sysdeps/linux/pci.c:118:38: [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). individual_device_file = open(file_path, O_RDONLY); data/discover-2.1.2/sysdeps/linux/pci.c:167: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[256]; data/discover-2.1.2/sysdeps/linux/pci.c:258: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). f = fopen(path, "r"); data/discover-2.1.2/sysdeps/linux/pci.c:267: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). f = fopen(path, "r"); data/discover-2.1.2/sysdeps/linux/pci.c:276: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). f = fopen(path, "r"); data/discover-2.1.2/sysdeps/linux/pcmcia.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 s[32], t[32]; data/discover-2.1.2/sysdeps/linux/pcmcia.c:94: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("/proc/devices", "r"); data/discover-2.1.2/sysdeps/linux/pcmcia.c:125: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(fn, O_RDONLY); data/discover-2.1.2/sysdeps/linux/pcmcia.c:181:13: [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(node->vendor, "%04x", id >> 16); data/discover-2.1.2/sysdeps/linux/pcmcia.c:182:13: [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(node->model, "%04x", id & 0xffff); data/discover-2.1.2/sysdeps/linux/pcmcia/bulkmem.h:201:61: [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 pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_t *m); data/discover-2.1.2/sysdeps/linux/pcmcia/cistpl.h:103: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 str[254]; data/discover-2.1.2/sysdeps/linux/pcmcia/cistpl.h:144: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 str[254]; data/discover-2.1.2/sysdeps/linux/pcmcia/cistpl.h:522: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 str[244]; data/discover-2.1.2/sysdeps/linux/pcmcia/cistpl.h:527: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 desc[30]; data/discover-2.1.2/sysdeps/linux/pcmcia/cs.h:87: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 Signature[2]; data/discover-2.1.2/sysdeps/linux/pcmcia/cs.h:405:55: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory, data/discover-2.1.2/sysdeps/linux/pcmcia/cs_types.h:66: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. typedef char dev_info_t[DEV_NAME_LEN]; data/discover-2.1.2/sysdeps/linux/pcmcia/ds.h:52: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[DEV_NAME_LEN]; data/discover-2.1.2/sysdeps/linux/pcmcia/ds.h:112: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 dev_name[DEV_NAME_LEN]; data/discover-2.1.2/sysdeps/linux/pcmcia/ds.h:119: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). u_int state, open; data/discover-2.1.2/sysdeps/linux/scsi.c:98:16: [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((file = fopen(PATH_PROC_SCSI, "r")) == NULL){ data/discover-2.1.2/sysdeps/linux/scsi.c:143:17: [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(node->busclass, "%x", i); data/discover-2.1.2/sysdeps/linux/usb.c:56: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 class[3], subclass[3]; data/discover-2.1.2/sysdeps/linux/usb.c:63:14: [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_PROC_USB, "r"))) { data/discover-2.1.2/tests/main.c:60: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(node->vendor, "%04x", ids[i] >> 16); data/discover-2.1.2/tests/main.c:61: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(node->model, "%04x", ids[i] & 0xffff); data/discover-2.1.2/discover/discover.c:353: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). char *end = &(text[strlen(text)-1]); data/discover-2.1.2/discover/discover.c:354: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). char *buffer = (char *)calloc(strlen(text)+1, 1); data/discover-2.1.2/discover/discover.c:809:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(argv[j]))) { data/discover-2.1.2/discover/discover.c:839: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). strlen(argv[j]))) { data/discover-2.1.2/lib/conf.c:40: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). #define NAMLEN(d) strlen((d)->d_name) data/discover-2.1.2/lib/core.c:87: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). (*status)->message = _discover_xmalloc(strlen(message) + 1); data/discover-2.1.2/lib/curl.c:59: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(PACKAGE_NAME); data/discover-2.1.2/lib/curl.c:61: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(PACKAGE_VERSION); data/discover-2.1.2/lib/curl.c:63: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(DISCOVER_TARGET); data/discover-2.1.2/lib/curl.c:66: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(DISCOVER_CURL_NAME); data/discover-2.1.2/lib/curl.c:68: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(curlversion); data/discover-2.1.2/lib/device-xml.c:397:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). old_len = strlen(current_data->text); data/discover-2.1.2/lib/device-xml.c:402:9: [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(current_data->text, data/discover-2.1.2/lib/utils.c:89: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(s) + 1; data/discover-2.1.2/sysdeps/linux/ata.c:114: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). if (strlen(model_name) > 0) { data/discover-2.1.2/sysdeps/linux/ata.c:115: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 (model_name[strlen(model_name) - 1] == '\n') data/discover-2.1.2/sysdeps/linux/ata.c:116: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). model_name[strlen(model_name) - 1] = '\0'; /* Chomp! */ data/discover-2.1.2/sysdeps/linux/ata.c:134: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). model_id[strlen(model_id) - 1] = '\0'; /* Chomp! */ data/discover-2.1.2/sysdeps/linux/pci.c:85:17: [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. if (sscanf(line, "%02x%02x\t%4s%4s", &bus, &sfcombo, data/discover-2.1.2/sysdeps/linux/pci.c:126:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(individual_device_file, &devtype, data/discover-2.1.2/sysdeps/linux/scsi.c:142:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(scsi_kernel_mappings[i])) == 0) { data/discover-2.1.2/sysdeps/linux/usb.c:74:25: [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. sscanf(line, "I: If#=%*2d Alt=%*2d #EPs=%*2d " ANALYSIS SUMMARY: Hits = 105 Lines analyzed = 11889 in approximately 0.41 seconds (29154 lines/second) Physical Source Lines of Code (SLOC) = 7244 Hits@level = [0] 45 [1] 22 [2] 64 [3] 3 [4] 15 [5] 1 Hits@level+ = [0+] 150 [1+] 105 [2+] 83 [3+] 19 [4+] 16 [5+] 1 Hits/KSLOC@level+ = [0+] 20.7068 [1+] 14.4948 [2+] 11.4578 [3+] 2.62286 [4+] 2.20872 [5+] 0.138045 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.