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/xtermcontrol-3.6/src/controlseq.h Examining data/xtermcontrol-3.6/src/getopt1.c Examining data/xtermcontrol-3.6/src/xtermcontrol.h Examining data/xtermcontrol-3.6/src/configuration.h Examining data/xtermcontrol-3.6/src/getopt.h Examining data/xtermcontrol-3.6/src/xtermcontrol.c Examining data/xtermcontrol-3.6/src/getopt.c Examining data/xtermcontrol-3.6/src/configuration.c FINAL RESULTS: data/xtermcontrol-3.6/src/configuration.c:192:13: [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(new_element->keyword, keyword); data/xtermcontrol-3.6/src/configuration.c:210:9: [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(new_element->value, value); data/xtermcontrol-3.6/src/getopt.c:214:9: [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. #ifndef getenv data/xtermcontrol-3.6/src/getopt.c:215:14: [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. extern char *getenv(); data/xtermcontrol-3.6/src/getopt.c:401:23: [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. posixly_correct = getenv("POSIXLY_CORRECT"); data/xtermcontrol-3.6/src/getopt.c:1157:5: [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. getopt(argc, argv, optstring) int argc; data/xtermcontrol-3.6/src/getopt.c:1185:13: [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. c = getopt(argc, argv, "abc:d:0123456789"); data/xtermcontrol-3.6/src/getopt.h:145:16: [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. extern int getopt(int ___argc, char *const *___argv, const char *__shortopts); data/xtermcontrol-3.6/src/getopt.h:147:16: [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. extern int getopt(); data/xtermcontrol-3.6/src/getopt.h:151:16: [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. extern int getopt_long(int ___argc, char *const *___argv, data/xtermcontrol-3.6/src/getopt.h:165:12: [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. extern int getopt(); data/xtermcontrol-3.6/src/getopt.h:167:12: [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. extern int getopt_long(); data/xtermcontrol-3.6/src/getopt1.c:66:5: [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. getopt_long(argc, argv, options, long_options, opt_index) int argc; data/xtermcontrol-3.6/src/getopt1.c:117:13: [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. c = getopt_long(argc, argv, "abc:d:0123456789", data/xtermcontrol-3.6/src/xtermcontrol.c:628:13: [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. c = getopt_long(argc, argv, "+fvh", longopts, &longindex); data/xtermcontrol-3.6/src/xtermcontrol.c:1204:86: [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. snprintf(configuration_file, sizeof(configuration_file), "%s%s", getenv("HOME"), optarg + 1); data/xtermcontrol-3.6/src/xtermcontrol.c:1240:80: [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. snprintf(configuration_file, sizeof(configuration_file), "%s/.%s", getenv("HOME"), program_name); data/xtermcontrol-3.6/src/xtermcontrol.c:1383:17: [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 ((term = getenv("TERM")) == NULL) data/xtermcontrol-3.6/src/xtermcontrol.c:1517:9: [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 (getenv("TMUX")) data/xtermcontrol-3.6/src/configuration.c:48: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 temp[BUFSIZ]; data/xtermcontrol-3.6/src/configuration.c:60:14: [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). stream = fopen(filepath, "r"); data/xtermcontrol-3.6/src/xtermcontrol.c:31: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 temp[BUFSIZ]; data/xtermcontrol-3.6/src/xtermcontrol.c:63: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 configuration_file[BUFSIZ]; data/xtermcontrol-3.6/src/xtermcontrol.c:1410:21: [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 ((ctty = fopen(ctty_path(), "r+")) == NULL) data/xtermcontrol-3.6/src/xtermcontrol.c:1515:12: [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 s[BUFSIZ]; data/xtermcontrol-3.6/src/xtermcontrol.c:1696:12: [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 s[BUFSIZ]; data/xtermcontrol-3.6/src/xtermcontrol.c:1781:12: [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 s[BUFSIZ]; data/xtermcontrol-3.6/src/xtermcontrol.c:1907: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 local_temp[20]; data/xtermcontrol-3.6/src/xtermcontrol.c:2049: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). fp = fopen(filepath, "w"); data/xtermcontrol-3.6/src/configuration.c:114:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(keyword, temp + pmatch[1].rm_so, matchlen); data/xtermcontrol-3.6/src/configuration.c:132:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(value, temp + pmatch[2].rm_so, matchlen); data/xtermcontrol-3.6/src/configuration.c:189: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). new_element->keyword = (char *)malloc(strlen(keyword) + 1); data/xtermcontrol-3.6/src/configuration.c:207:41: [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). new_element->value = (char *)malloc(strlen(value) + 1); data/xtermcontrol-3.6/src/getopt.c:237:50: [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 (!defined __STDC__ || !__STDC__) && !defined strlen data/xtermcontrol-3.6/src/getopt.c:240:12: [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). extern int strlen(const char *); data/xtermcontrol-3.6/src/getopt.c:430:53: [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 = nonoption_flags_max_len = strlen(orig_str); data/xtermcontrol-3.6/src/getopt.c:651:73: [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 ((unsigned int)(nameend - nextchar) == (unsigned int)strlen(p->name)) data/xtermcontrol-3.6/src/getopt.c:691: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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/getopt.c:753:33: [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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/getopt.c:786:33: [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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/getopt.c:791: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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/getopt.c:967:63: [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 ((unsigned int)(nameend - nextchar) == strlen(p->name)) data/xtermcontrol-3.6/src/getopt.c:1006:29: [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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/getopt.c:1043:37: [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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/getopt.c:1074:37: [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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/getopt.c:1078:29: [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). nextchar += strlen(nextchar); data/xtermcontrol-3.6/src/xtermcontrol.c:1620:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(TTY_FILENO, p, 1); ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 6927 in approximately 0.17 seconds (39986 lines/second) Physical Source Lines of Code (SLOC) = 5230 Hits@level = [0] 153 [1] 18 [2] 10 [3] 17 [4] 2 [5] 0 Hits@level+ = [0+] 200 [1+] 47 [2+] 29 [3+] 19 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 38.2409 [1+] 8.98662 [2+] 5.54493 [3+] 3.63289 [4+] 0.382409 [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.