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/gexec-0.4/autocomp.c Examining data/gexec-0.4/autocomp.h Examining data/gexec-0.4/gexec.c FINAL RESULTS: data/gexec-0.4/gexec.c:152:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/.gexec", getenv("HOME")); data/gexec-0.4/gexec.c:182:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/.gexec", getenv("HOME")); data/gexec-0.4/gexec.c:227:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/.gexec_history", getenv("HOME")); data/gexec-0.4/gexec.c:257:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/.gexec_history", getenv("HOME")); data/gexec-0.4/gexec.c:329:7: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. if (snprintf(tmp_command, buf_size, task->cmd_termemu, final_command) >= buf_size) { data/gexec-0.4/gexec.c:342:7: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. if (snprintf(tmp_command, buf_size, task->cmd_su, final_command) >= buf_size) { data/gexec-0.4/gexec.c:507:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(new_entry, "%s%s", task->tabcomp_command, (char *)task->tabcomp_current_match->data); data/gexec-0.4/autocomp.c:55:18: [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 ((env_path = getenv("PATH")) == NULL) { data/gexec-0.4/gexec.c:150:51: [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. filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:152:33: [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. sprintf(filename, "%s/.gexec", getenv("HOME")); data/gexec-0.4/gexec.c:181:51: [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. filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:182:33: [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. sprintf(filename, "%s/.gexec", getenv("HOME")); data/gexec-0.4/gexec.c:226:51: [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. filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:227:41: [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. sprintf(filename, "%s/.gexec_history", getenv("HOME")); data/gexec-0.4/gexec.c:256:51: [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. filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:257:41: [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. sprintf(filename, "%s/.gexec_history", getenv("HOME")); data/gexec-0.4/gexec.c:154: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). f_out = fopen(filename, "w"); data/gexec-0.4/gexec.c:173: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 line[4096]; data/gexec-0.4/gexec.c:184: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_in = fopen(filename, "r"); data/gexec-0.4/gexec.c:203:29: [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). settings->history_max = atoi(tokens[1]); data/gexec-0.4/gexec.c:224: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 line[4096]; data/gexec-0.4/gexec.c:229: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_in = fopen(filename, "r"); data/gexec-0.4/gexec.c:261: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). f_out = fopen(filename, "w"); data/gexec-0.4/autocomp.c:136: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 (completion_qry[0] == '/' && strlen(path_and_file) == 0) { data/gexec-0.4/autocomp.c:182: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). (strncmp(direntry->d_name, command, strlen(command)) == 0)) { data/gexec-0.4/autocomp.c:187:62: [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). match = g_list_append (match, g_strdup(direntry->d_name+strlen(command))); data/gexec-0.4/gexec.c:150:44: [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). filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:181:44: [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). filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:226:44: [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). filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:256:44: [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). filename = (char *)malloc(sizeof(char) * (strlen(getenv("HOME")) + 15 + 1) ); data/gexec-0.4/gexec.c:326:19: [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 buf_size = (strlen(final_command) + strlen(task->cmd_termemu)); data/gexec-0.4/gexec.c:326:43: [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 buf_size = (strlen(final_command) + strlen(task->cmd_termemu)); data/gexec-0.4/gexec.c:339:19: [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 buf_size = (strlen(final_command) + strlen(task->cmd_su)); data/gexec-0.4/gexec.c:339:43: [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 buf_size = (strlen(final_command) + strlen(task->cmd_su)); data/gexec-0.4/gexec.c:505: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). new_entry = malloc(sizeof(char) * (strlen(task->tabcomp_command) + strlen(task->tabcomp_current_match->data) + 1 ) ); data/gexec-0.4/gexec.c:505:71: [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_entry = malloc(sizeof(char) * (strlen(task->tabcomp_command) + strlen(task->tabcomp_current_match->data) + 1 ) ); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 972 in approximately 0.05 seconds (19787 lines/second) Physical Source Lines of Code (SLOC) = 589 Hits@level = [0] 18 [1] 13 [2] 7 [3] 9 [4] 7 [5] 0 Hits@level+ = [0+] 54 [1+] 36 [2+] 23 [3+] 16 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 91.6808 [1+] 61.1205 [2+] 39.0492 [3+] 27.1647 [4+] 11.8846 [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.