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/xinput-1.6.3/src/setptr.c Examining data/xinput-1.6.3/src/list.c Examining data/xinput-1.6.3/src/test_xi2.c Examining data/xinput-1.6.3/src/transform.c Examining data/xinput-1.6.3/src/xinput.c Examining data/xinput-1.6.3/src/xinput.h Examining data/xinput-1.6.3/src/setcp.c Examining data/xinput-1.6.3/src/property.c Examining data/xinput-1.6.3/src/setmode.c Examining data/xinput-1.6.3/src/feedback.c Examining data/xinput-1.6.3/src/setint.c Examining data/xinput-1.6.3/src/state.c Examining data/xinput-1.6.3/src/hierarchy.c Examining data/xinput-1.6.3/src/test.c Examining data/xinput-1.6.3/src/buttonmap.c FINAL RESULTS: data/xinput-1.6.3/src/hierarchy.c:30:5: [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(stderr, __VA_ARGS__); \ data/xinput-1.6.3/src/xinput.c:215:26: [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. forced_version = getenv("XINPUT_XI2_VERSION"); data/xinput-1.6.3/src/buttonmap.c:145: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). map[idx - 1] = atoi(argv[idx]); data/xinput-1.6.3/src/feedback.c:78:27: [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). feedback.threshold = atoi(argv[1]); data/xinput-1.6.3/src/feedback.c:79:26: [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). feedback.accelNum = atoi(argv[2]); data/xinput-1.6.3/src/feedback.c:80:28: [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). feedback.accelDenom = atoi(argv[3]); data/xinput-1.6.3/src/hierarchy.c:50:33: [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). c.send_core = (argc >= 2) ? atoi(argv[1]) : 1; data/xinput-1.6.3/src/hierarchy.c:51:30: [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). c.enable = (argc >= 3) ? atoi(argv[2]) : 1; data/xinput-1.6.3/src/property.c:46:16: [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). return atoi(name); data/xinput-1.6.3/src/property.c:380:33: [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). data.c[i] = atoi(argv[2 + i]); data/xinput-1.6.3/src/property.c:383:33: [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). data.s[i] = atoi(argv[2 + i]); data/xinput-1.6.3/src/property.c:386:33: [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). data.l[i] = atoi(argv[2 + i]); data/xinput-1.6.3/src/property.c:672:33: [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). data.c[i] = atoi(argv[2 + i]); data/xinput-1.6.3/src/property.c:675:33: [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). data.s[i] = atoi(argv[2 + i]); data/xinput-1.6.3/src/property.c:678:33: [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). data.l[i] = atoi(argv[2 + i]); data/xinput-1.6.3/src/property.c:767:17: [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). format = atoi(argv[2]); data/xinput-1.6.3/src/property.c:823:22: [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). format = atoi(option + 1); data/xinput-1.6.3/src/property.c:843: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 *new_argv[3] = { NULL, "Device Enabled", "0" }; data/xinput-1.6.3/src/property.c:857: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 *new_argv[3] = { NULL, "Device Enabled", "1" }; data/xinput-1.6.3/src/setint.c:44: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). control.id = atoi(argv[1]); data/xinput-1.6.3/src/setint.c:45:30: [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). control.int_to_display = atoi(argv[2]); data/xinput-1.6.3/src/setptr.c:44: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). xaxis = atoi(argv[1]); data/xinput-1.6.3/src/setptr.c:45: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). yaxis = atoi(argv[2]); data/xinput-1.6.3/src/transform.c:99: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(data.f, m->m, sizeof(m->m)); data/xinput-1.6.3/src/xinput.c:253:7: [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). id = atoi(name); data/xinput-1.6.3/src/xinput.c:325:7: [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). id = atoi(name); data/xinput-1.6.3/src/property.c:123: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). j += strlen((char*)ptr); /* The loop's j++ jumps over the data/xinput-1.6.3/src/property.c:125: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). ptr += strlen((char*)ptr); /* ptr += size below jumps over data/xinput-1.6.3/src/property.c:489: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). j += strlen((char*)ptr); /* The loop's j++ jumps over the data/xinput-1.6.3/src/property.c:491: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). ptr += strlen((char*)ptr); /* ptr += size below jumps over data/xinput-1.6.3/src/property.c:809:42: [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 (!strncmp(argv[i], "--type=", strlen("--type="))) { data/xinput-1.6.3/src/property.c:822:51: [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). } else if (!strncmp(argv[i], "--format=", strlen("--format="))) { data/xinput-1.6.3/src/transform.c:278: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). if (strlen(output_name) < strlen(prefix) + 1 || data/xinput-1.6.3/src/transform.c:278:31: [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(output_name) < strlen(prefix) + 1 || data/xinput-1.6.3/src/transform.c:279:38: [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). strncmp(output_name, prefix, strlen(prefix)) != 0) data/xinput-1.6.3/src/transform.c:286: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). head = output_name[strlen(prefix)] - '0'; data/xinput-1.6.3/src/transform.c:342:47: [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 (strncmp("HEAD-", output_name, strlen("HEAD-")) == 0) data/xinput-1.6.3/src/xinput.c:241: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). int len = strlen(name); data/xinput-1.6.3/src/xinput.c:293: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). if (strncmp(name, "pointer:", strlen("pointer:")) == 0 && data/xinput-1.6.3/src/xinput.c:294: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). strcmp(info->name, name + strlen("pointer:")) == 0 && data/xinput-1.6.3/src/xinput.c:299: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 (strncmp(name, "keyboard:", strlen("keyboard:")) == 0 && data/xinput-1.6.3/src/xinput.c:300: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). strcmp(info->name, name + strlen("keyboard:")) == 0 && data/xinput-1.6.3/src/xinput.c:317:20: [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(i = 0; i < strlen(name); i++) { ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 3751 in approximately 0.13 seconds (29269 lines/second) Physical Source Lines of Code (SLOC) = 2856 Hits@level = [0] 314 [1] 17 [2] 24 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 357 [1+] 43 [2+] 26 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 125 [1+] 15.056 [2+] 9.10364 [3+] 0.70028 [4+] 0.35014 [5+] 0 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.