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/joy2key-1.6.3/acconfig.h Examining data/joy2key-1.6.3/joy2key.c FINAL RESULTS: data/joy2key-1.6.3/joy2key.c:241:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(string, "xwininfo -name \"%s\"", argv[1]); data/joy2key-1.6.3/joy2key.c:243:7: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. foo=popen(string, "r"); data/joy2key-1.6.3/joy2key.c:250:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(string, "xwininfo -id \"%s\"", argv[1]); data/joy2key-1.6.3/joy2key.c:251:8: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. foo=popen(string, "r"); data/joy2key-1.6.3/joy2key.c:270:4: [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(string, argv[1]); data/joy2key-1.6.3/joy2key.c:272:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(string, "/dev/tty%s", argv[1][0] == '-' ? "" : argv[1]); data/joy2key-1.6.3/joy2key.c:405:4: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:410:6: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:420:7: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:429:5: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:454:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(rcfile, "%s/%s", homedir, DEFAULT_RCFILE); data/joy2key-1.6.3/joy2key.c:463:5: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:468:7: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:478:8: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:488:6: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:493:4: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:498:6: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:502:7: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:512:8: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:523:5: [4] (buffer) fscanf: 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. fscanf(file, " %s ", line); data/joy2key-1.6.3/joy2key.c:446:20: [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. homedir=getenv("HOME"); data/joy2key-1.6.3/joy2key.c:178: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 string[255], data/joy2key-1.6.3/joy2key.c:210:14: [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). if((jsfd=open(device,O_RDONLY))==-1) data/joy2key-1.6.3/joy2key.c:238:5: [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(string, "xwininfo"); data/joy2key-1.6.3/joy2key.c:274:17: [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). if((consolefd=open(string, O_RDONLY, 0)) < 0) data/joy2key-1.6.3/joy2key.c:388: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 *rcargv[255], line[255]; data/joy2key-1.6.3/joy2key.c:400: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). if((file=fopen(argv[i+1], "r"))==NULL) data/joy2key-1.6.3/joy2key.c:456: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). if((file=fopen(rcfile, "r"))==NULL) data/joy2key-1.6.3/joy2key.c:626:39: [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). axis_threshold[thresh_counter][0]=atoi(argv[i]); data/joy2key-1.6.3/joy2key.c:627:41: [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). axis_threshold[thresh_counter++][1]=atoi(argv[++i]); data/joy2key-1.6.3/joy2key.c:638:40: [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). if((repeat_time.it_interval.tv_usec=atoi(argv[++i]))==0) data/joy2key-1.6.3/joy2key.c:660: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). if((deadzone=atoi(argv[++i]))==0) data/joy2key-1.6.3/joy2key.c:331:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(jsfd, &js, sizeof(struct js_event)); data/joy2key-1.6.3/joy2key.c:416:14: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(fgetc(file)!='\n'); data/joy2key-1.6.3/joy2key.c:452:7: [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). x=strlen(homedir) + strlen(rcfile) + 2; data/joy2key-1.6.3/joy2key.c:452: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). x=strlen(homedir) + strlen(rcfile) + 2; data/joy2key-1.6.3/joy2key.c:474:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(fgetc(file)!='\n'); data/joy2key-1.6.3/joy2key.c:508:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(fgetc(file)!='\n'); data/joy2key-1.6.3/joy2key.c:594: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(argv[i])==1) && (isupper(argv[i][0]))) data/joy2key-1.6.3/joy2key.c:751:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(jsfd, &js, sizeof(struct js_event)); data/joy2key-1.6.3/joy2key.c:764:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(jsfd, &js, sizeof(struct js_event)); data/joy2key-1.6.3/joy2key.c:776:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(jsfd, &js, sizeof(struct js_event)); ANALYSIS SUMMARY: Hits = 42 Lines analyzed = 1003 in approximately 0.04 seconds (25387 lines/second) Physical Source Lines of Code (SLOC) = 826 Hits@level = [0] 48 [1] 10 [2] 11 [3] 1 [4] 20 [5] 0 Hits@level+ = [0+] 90 [1+] 42 [2+] 32 [3+] 21 [4+] 20 [5+] 0 Hits/KSLOC@level+ = [0+] 108.959 [1+] 50.8475 [2+] 38.7409 [3+] 25.4237 [4+] 24.2131 [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.