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/yavta-0.0+git20190222.405e530/include/linux/v4l2-common.h Examining data/yavta-0.0+git20190222.405e530/include/linux/v4l2-controls.h Examining data/yavta-0.0+git20190222.405e530/include/linux/videodev2.h Examining data/yavta-0.0+git20190222.405e530/yavta.c FINAL RESULTS: data/yavta-0.0+git20190222.405e530/yavta.c:2061:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%.*s%06u%s", (int)(p - pattern), pattern, data/yavta-0.0+git20190222.405e530/yavta.c:2065:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(filename, pattern); data/yavta-0.0+git20190222.405e530/yavta.c:2414:14: [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 ((c = getopt_long(argc, argv, "B:c::Cd:f:F::hi:Iln:p::q:r:R::s:t:uw:", opts, NULL)) != -1) { data/yavta-0.0+git20190222.405e530/include/linux/videodev2.h:840: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 APP_data[60]; /* Data in the JPEG APPn segment. */ data/yavta-0.0+git20190222.405e530/include/linux/videodev2.h:843: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 COM_data[60]; /* Data in JPEG COM segment */ data/yavta-0.0+git20190222.405e530/include/linux/videodev2.h:1683: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/yavta-0.0+git20190222.405e530/include/linux/videodev2.h:2308:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[32]; data/yavta-0.0+git20190222.405e530/include/linux/videodev2.h:2325: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/yavta-0.0+git20190222.405e530/yavta.c:94:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char pause_filename[23]; data/yavta-0.0+git20190222.405e530/yavta.c:106:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(pause_filename, O_CREAT, 0); data/yavta-0.0+git20190222.405e530/yavta.c:156:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(pause_filename, ".yavta.wait.%u", getpid()); data/yavta-0.0+git20190222.405e530/yavta.c:396: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 name[5]; data/yavta-0.0+git20190222.405e530/yavta.c:494: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). dev->fd = open(devname, O_RDWR); data/yavta-0.0+git20190222.405e530/yavta.c:1222: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(dev->buffers[buf.index].mem[i], dev->pattern[i], data/yavta-0.0+git20190222.405e530/yavta.c:1458: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(val, O_RDONLY); data/yavta-0.0+git20190222.405e530/yavta.c:1908:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, O_RDONLY); data/yavta-0.0+git20190222.405e530/yavta.c:2069: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_CREAT | O_WRONLY | (append ? O_APPEND : O_TRUNC), data/yavta-0.0+git20190222.405e530/yavta.c:2428:15: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). nframes = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2434:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). delay = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2459:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). input = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2468:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). nbufs = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2474:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). pause_count = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2479:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). quality = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2492:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). rt_priority = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2533:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). buffer_size = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2542:10: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). ret = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2576:11: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). skip = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2582:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). stride = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:2595:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). userptr_offset = atoi(optarg); data/yavta-0.0+git20190222.405e530/yavta.c:133:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(0, &c, 1); data/yavta-0.0+git20190222.405e530/yavta.c:1464:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size = read(fd, ctrl->ptr, ctrl->size); data/yavta-0.0+git20190222.405e530/yavta.c:1566:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ctrl.string, val, ctrl.size); data/yavta-0.0+git20190222.405e530/yavta.c:1926:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, dev->pattern[plane], size); data/yavta-0.0+git20190222.405e530/yavta.c:2054: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). size = strlen(pattern); data/yavta-0.0+git20190222.405e530/yavta.c:2203:4: [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. usleep(delay * 1000); ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 6409 in approximately 0.17 seconds (38095 lines/second) Physical Source Lines of Code (SLOC) = 4665 Hits@level = [0] 185 [1] 6 [2] 26 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 220 [1+] 35 [2+] 29 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 47.1597 [1+] 7.50268 [2+] 6.21651 [3+] 0.643087 [4+] 0.428725 [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.