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/xautomation-1.09/xmousepos.c Examining data/xautomation-1.09/debug.h Examining data/xautomation-1.09/image.c Examining data/xautomation-1.09/visgrep.c Examining data/xautomation-1.09/debug.c Examining data/xautomation-1.09/kbd.h Examining data/xautomation-1.09/pat2ppm.c Examining data/xautomation-1.09/xte.c Examining data/xautomation-1.09/keysym_map.h Examining data/xautomation-1.09/image.h Examining data/xautomation-1.09/png2pat.c Examining data/xautomation-1.09/rgb2pat.c Examining data/xautomation-1.09/multikey_map.h Examining data/xautomation-1.09/patextract.c FINAL RESULTS: data/xautomation-1.09/debug.h:28:58: [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. #define dmsg( x, y, args... ) if( x <= _DEBUGLEVEL ) { fprintf( stderr, "DEBUG %d) " y, x, ## args ); } data/xautomation-1.09/visgrep.c:58:20: [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, "hX:Y:x:d:y:t:baW:H:" ) ) != EOF ) { data/xautomation-1.09/xmousepos.c:63:31: [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. if (! (display_name = getenv("DISPLAY")) ){ data/xautomation-1.09/xte.c:344:20: [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, "hd:x:i:" ) ) != EOF ) { data/xautomation-1.09/image.c:58: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 sig[ 4 ]; data/xautomation-1.09/image.c:64:9: [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). f = fopen( fname, "r" ); data/xautomation-1.09/image.c:118:9: [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). f = fopen( fname, "r" ); data/xautomation-1.09/image.c:157:9: [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). f = fopen( fname, "r" ); data/xautomation-1.09/image.c:229:16: [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). FILE *in = fopen( fname, "rb" ); data/xautomation-1.09/image.c:337:9: [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). f = fopen( fname, "w" ); data/xautomation-1.09/image.c:367:9: [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). f = fopen( fname, "w" ); data/xautomation-1.09/xte.c:162:5: [2] (buffer) wchar_t: 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. wchar_t thing[ CMD_STRING_MAXLEN ]; data/xautomation-1.09/xte.c:163:5: [2] (buffer) wchar_t: 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. wchar_t wc_singlechar_str[2]; data/xautomation-1.09/xte.c:237: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 str[ CMD_STRING_MAXLEN ]; data/xautomation-1.09/xte.c:34:39: [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). #define IS_CMD( x, y ) strncmp( x, y, strlen( y ) ) == 0 data/xautomation-1.09/xte.c:246:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( str, &cmd[ 4 ], 128 ); data/xautomation-1.09/xte.c:249:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( str, &cmd[ 8 ], CMD_STRING_MAXLEN ); data/xautomation-1.09/xte.c:252:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( str, &cmd[ 6 ], CMD_STRING_MAXLEN ); data/xautomation-1.09/xte.c:267:9: [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( tmpx ); data/xautomation-1.09/xte.c:277:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( str, &cmd[ 4 ], CMD_STRING_MAXLEN ); data/xautomation-1.09/xte.c:458:18: [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). buf[ strlen( buf ) - 1 ] = 0; /* Chop \n */ ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 2942 in approximately 0.18 seconds (16338 lines/second) Physical Source Lines of Code (SLOC) = 2247 Hits@level = [0] 65 [1] 7 [2] 10 [3] 3 [4] 1 [5] 0 Hits@level+ = [0+] 86 [1+] 21 [2+] 14 [3+] 4 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 38.2733 [1+] 9.34579 [2+] 6.23053 [3+] 1.78015 [4+] 0.445038 [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.