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/inputlirc-33/inputlircd.c FINAL RESULTS: data/inputlirc-33/inputlircd.c:262:4: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(dir, 0755); data/inputlirc-33/inputlircd.c:277:2: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(device, 0666); data/inputlirc-33/inputlircd.c:446:15: [3] (buffer) getopt: 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((opt = getopt(argc, argv, "cd:gm:n:fu:r:t:")) != -1) { data/inputlirc-33/inputlircd.c:93: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 event_name[100]; data/inputlirc-33/inputlircd.c:94: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 lirc_name[100]; data/inputlirc-33/inputlircd.c:100: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). table = fopen(path, "r"); data/inputlirc-33/inputlircd.c:142: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(name, O_RDONLY); data/inputlirc-33/inputlircd.c:209: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/inputlirc-33/inputlircd.c:223: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(g.gl_pathv[i], O_RDONLY); data/inputlirc-33/inputlircd.c:312: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 message[1000]; data/inputlirc-33/inputlircd.c:458: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). key_min = atoi(optarg); data/inputlirc-33/inputlircd.c:471: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). repeat_time = atoi(optarg) * 1000L; data/inputlirc-33/inputlircd.c:107:7: [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, " %99s = %99s ", event_name, lirc_name) != 2) data/inputlirc-33/inputlircd.c:112:6: [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(event_name) < 1 || strlen(lirc_name) < 1) data/inputlirc-33/inputlircd.c:112:32: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(strlen(event_name) < 1 || strlen(lirc_name) < 1) data/inputlirc-33/inputlircd.c:268:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sa.sun_path, device, sizeof sa.sun_path - 1); data/inputlirc-33/inputlircd.c:316:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(evdev->fd, &event, sizeof event) != sizeof event) { ANALYSIS SUMMARY: Hits = 17 Lines analyzed = 539 in approximately 0.04 seconds (13954 lines/second) Physical Source Lines of Code (SLOC) = 427 Hits@level = [0] 31 [1] 5 [2] 9 [3] 1 [4] 0 [5] 2 Hits@level+ = [0+] 48 [1+] 17 [2+] 12 [3+] 3 [4+] 2 [5+] 2 Hits/KSLOC@level+ = [0+] 112.412 [1+] 39.8126 [2+] 28.103 [3+] 7.02576 [4+] 4.68384 [5+] 4.68384 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.