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/libraw1394-2.1.2/src/raw1394.h Examining data/libraw1394-2.1.2/src/csr.h Examining data/libraw1394-2.1.2/src/ieee1394.h Examining data/libraw1394-2.1.2/src/main.c Examining data/libraw1394-2.1.2/src/eventloop.c Examining data/libraw1394-2.1.2/src/errors.c Examining data/libraw1394-2.1.2/src/readwrite.c Examining data/libraw1394-2.1.2/src/iso.c Examining data/libraw1394-2.1.2/src/fcp.c Examining data/libraw1394-2.1.2/src/arm.c Examining data/libraw1394-2.1.2/src/version.c Examining data/libraw1394-2.1.2/src/kernel-raw1394.h Examining data/libraw1394-2.1.2/src/raw1394_private.h Examining data/libraw1394-2.1.2/src/ieee1394-ioctl.h Examining data/libraw1394-2.1.2/src/dispatch.c Examining data/libraw1394-2.1.2/src/fw.c Examining data/libraw1394-2.1.2/src/fw-iso.c Examining data/libraw1394-2.1.2/src/fw.h Examining data/libraw1394-2.1.2/src/firewire-cdev.h Examining data/libraw1394-2.1.2/src/firewire-constants.h Examining data/libraw1394-2.1.2/tools/dumpiso.c Examining data/libraw1394-2.1.2/tools/sendiso.c Examining data/libraw1394-2.1.2/tools/testlibraw.c FINAL RESULTS: data/libraw1394-2.1.2/src/fw.c:152:3: [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(filename, sizeof filename, FW_DEVICE_DIR "/%s", de->d_name); data/libraw1394-2.1.2/src/fw.c:366:2: [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(filename, sizeof filename, FW_DEVICE_DIR "/%s", event->name); data/libraw1394-2.1.2/tools/testlibraw.c:244:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(not_compatible); data/libraw1394-2.1.2/tools/testlibraw.c:247:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(not_loaded); data/libraw1394-2.1.2/src/main.c:127:27: [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. handle->fd = open(getenv("RAW1394DEV") ? getenv("RAW1394DEV"): defaultDevice, O_RDWR); data/libraw1394-2.1.2/src/main.c:127:50: [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. handle->fd = open(getenv("RAW1394DEV") ? getenv("RAW1394DEV"): defaultDevice, O_RDWR); data/libraw1394-2.1.2/tools/dumpiso.c:60:21: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long(argc, argv, "hc:p:", opts, &index); data/libraw1394-2.1.2/tools/sendiso.c:65:21: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long(argc, argv, "f:l:is:p:h", opts, &index); data/libraw1394-2.1.2/src/fw-iso.c:375: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(fwhandle->iso.head, data, len); data/libraw1394-2.1.2/src/fw-iso.c:480: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). handle->iso.fd = open(handle->iso.filename, O_RDWR); data/libraw1394-2.1.2/src/fw.c:129:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[32]; data/libraw1394-2.1.2/src/fw.c:154:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, O_RDWR); data/libraw1394-2.1.2/src/fw.c:296: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(&fwhandle->reset, &u->bus_reset, sizeof fwhandle->reset); data/libraw1394-2.1.2/src/fw.c:305:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(rc->data, u->response.data, u->response.length); data/libraw1394-2.1.2/src/fw.c:334: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(u64_to_ptr(u->iso_resource.closure), u, data/libraw1394-2.1.2/src/fw.c:356:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[32]; data/libraw1394-2.1.2/src/fw.c:367:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, O_RDWR); data/libraw1394-2.1.2/src/fw.c:659:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[32]; data/libraw1394-2.1.2/src/fw.c:682:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, O_RDWR); data/libraw1394-2.1.2/src/fw.c:722:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&handle->reset, &reset, sizeof handle->reset); data/libraw1394-2.1.2/src/fw.c:768:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[0]; data/libraw1394-2.1.2/src/fw.c:782:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[0]; data/libraw1394-2.1.2/src/fw.c:852:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(allocation->data + pos, data, length); data/libraw1394-2.1.2/src/fw.c:894: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(rrb->request.buffer, data, in_length); data/libraw1394-2.1.2/src/fw.c:899: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(rrb->response.buffer, allocation->data + pos, response.length); data/libraw1394-2.1.2/src/fw.c:933: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(allocation->data, initial_value, length); data/libraw1394-2.1.2/src/fw.c:1001: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(allocation->data + allocation->offset - start, buf, length); data/libraw1394-2.1.2/src/fw.c:1018:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, allocation->data + allocation->offset - start, length); data/libraw1394-2.1.2/src/fw.h:31:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. union { char c[4]; __u32 q; } u = { { 1, 0, 0, 0 } }; data/libraw1394-2.1.2/src/fw.h:56: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 device_file[32]; data/libraw1394-2.1.2/src/fw.h:70:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[FILENAME_SIZE]; data/libraw1394-2.1.2/src/iso.c:361: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(ihandle->iso_buffer + info.offset, data, len); data/libraw1394-2.1.2/src/main.c:127:22: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). handle->fd = open(getenv("RAW1394DEV") ? getenv("RAW1394DEV"): defaultDevice, O_RDWR); data/libraw1394-2.1.2/src/main.c:130:30: [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). handle->fd = open(defaultDevice, O_RDWR); data/libraw1394-2.1.2/src/main.c:141:30: [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). handle->fd = open(defaultDevice, O_RDWR); data/libraw1394-2.1.2/src/raw1394.h:564:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[32]; data/libraw1394-2.1.2/tools/dumpiso.c:138:16: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (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 header[32] = "1394 isodump v2"; data/libraw1394-2.1.2/tools/sendiso.c:146: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. static unsigned char buffer[BUF_SIZE + BUF_HEAD]; data/libraw1394-2.1.2/tools/sendiso.c:214:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[32]; data/libraw1394-2.1.2/tools/sendiso.c:219:24: [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). file = open(filename, O_RDONLY, 0); data/libraw1394-2.1.2/src/eventloop.c:37:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(ihandle->fd, &req, sizeof(req)) < 0) { data/libraw1394-2.1.2/src/fw-iso.c:312:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fwhandle->iso.fd, fwhandle->buffer, sizeof fwhandle->buffer); data/libraw1394-2.1.2/src/fw.c:120:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return strncmp(name, FW_DEVICE_PREFIX, strlen(FW_DEVICE_PREFIX)) == 0 data/libraw1394-2.1.2/src/fw.c:121: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). && isdigit(name[strlen(FW_DEVICE_PREFIX)]); data/libraw1394-2.1.2/src/fw.c:174:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ports[i].device_file, filename, fname_str_sz); data/libraw1394-2.1.2/src/fw.c:194:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(handle->mode.fw->pipe_fds[0], &value, sizeof value) < 0) data/libraw1394-2.1.2/src/fw.c:277:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fwhandle->devices[i].fd, data/libraw1394-2.1.2/src/fw.c:408:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fwhandle->devices[i].filename, filename, fname_str_sz); data/libraw1394-2.1.2/src/fw.c:432:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fwhandle->inotify_fd, event, BUFFER_SIZE); data/libraw1394-2.1.2/src/fw.c:645:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(pinf[i].name, handle->ports[i].device_file, data/libraw1394-2.1.2/src/fw.c:708:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(handle->devices[i].filename, filename, fname_str_sz); data/libraw1394-2.1.2/src/main.c:98:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(h->fd, &req, sizeof(req)) < 0) return -1; data/libraw1394-2.1.2/src/main.c:103:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(h->fd, &req, sizeof(req)) < 0) return -1; data/libraw1394-2.1.2/src/main.c:271:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(handle->fd, &req, sizeof(req)) < 0) return -1; data/libraw1394-2.1.2/src/main.c:298:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(handle->fd, &req, sizeof(req)) < 0) return -1; data/libraw1394-2.1.2/tools/sendiso.c:151:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). count = read(file, buffer, BUF_HEAD); data/libraw1394-2.1.2/tools/sendiso.c:167:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(file, buffer + count, data/libraw1394-2.1.2/tools/sendiso.c:229:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(file, buffer, count); ANALYSIS SUMMARY: Hits = 58 Lines analyzed = 9346 in approximately 0.25 seconds (37275 lines/second) Physical Source Lines of Code (SLOC) = 5963 Hits@level = [0] 63 [1] 18 [2] 32 [3] 4 [4] 4 [5] 0 Hits@level+ = [0+] 121 [1+] 58 [2+] 40 [3+] 8 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 20.2918 [1+] 9.72665 [2+] 6.70803 [3+] 1.34161 [4+] 0.670803 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.