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/yash-2.50/alias.c Examining data/yash-2.50/alias.h Examining data/yash-2.50/arith.c Examining data/yash-2.50/arith.h Examining data/yash-2.50/builtin.c Examining data/yash-2.50/builtin.h Examining data/yash-2.50/builtins/printf.c Examining data/yash-2.50/builtins/printf.h Examining data/yash-2.50/builtins/test.c Examining data/yash-2.50/builtins/test.h Examining data/yash-2.50/builtins/ulimit.c Examining data/yash-2.50/builtins/ulimit.h Examining data/yash-2.50/common.h Examining data/yash-2.50/exec.c Examining data/yash-2.50/exec.h Examining data/yash-2.50/expand.c Examining data/yash-2.50/expand.h Examining data/yash-2.50/hashtable.c Examining data/yash-2.50/hashtable.h Examining data/yash-2.50/history.c Examining data/yash-2.50/history.h Examining data/yash-2.50/input.c Examining data/yash-2.50/input.h Examining data/yash-2.50/job.c Examining data/yash-2.50/job.h Examining data/yash-2.50/lineedit/complete.c Examining data/yash-2.50/lineedit/complete.h Examining data/yash-2.50/lineedit/compparse.c Examining data/yash-2.50/lineedit/compparse.h Examining data/yash-2.50/lineedit/display.c Examining data/yash-2.50/lineedit/display.h Examining data/yash-2.50/lineedit/editing.c Examining data/yash-2.50/lineedit/editing.h Examining data/yash-2.50/lineedit/key.h Examining data/yash-2.50/lineedit/keymap.c Examining data/yash-2.50/lineedit/keymap.h Examining data/yash-2.50/lineedit/lineedit.c Examining data/yash-2.50/lineedit/lineedit.h Examining data/yash-2.50/lineedit/terminfo.c Examining data/yash-2.50/lineedit/terminfo.h Examining data/yash-2.50/lineedit/trie.c Examining data/yash-2.50/lineedit/trie.h Examining data/yash-2.50/lineedit/trietest.c Examining data/yash-2.50/lineedit/trietestw.c Examining data/yash-2.50/mail.c Examining data/yash-2.50/mail.h Examining data/yash-2.50/makesignum.c Examining data/yash-2.50/option.c Examining data/yash-2.50/option.h Examining data/yash-2.50/parser.c Examining data/yash-2.50/parser.h Examining data/yash-2.50/path.c Examining data/yash-2.50/path.h Examining data/yash-2.50/plist.c Examining data/yash-2.50/plist.h Examining data/yash-2.50/redir.c Examining data/yash-2.50/redir.h Examining data/yash-2.50/refcount.h Examining data/yash-2.50/sig.c Examining data/yash-2.50/sig.h Examining data/yash-2.50/siglist.h Examining data/yash-2.50/strbuf.c Examining data/yash-2.50/strbuf.h Examining data/yash-2.50/tests/checkfg.c Examining data/yash-2.50/tests/ptwrap.c Examining data/yash-2.50/tests/resetsig.c Examining data/yash-2.50/util.c Examining data/yash-2.50/util.h Examining data/yash-2.50/variable.c Examining data/yash-2.50/variable.h Examining data/yash-2.50/xfnmatch.c Examining data/yash-2.50/xfnmatch.h Examining data/yash-2.50/xgetopt.c Examining data/yash-2.50/xgetopt.h Examining data/yash-2.50/yash.c Examining data/yash-2.50/yash.h FINAL RESULTS: data/yash-2.50/exec.c:2097:6: [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, data/yash-2.50/exec.c:2102:6: [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, gt(" Use the -f option to exec anyway.\n")); data/yash-2.50/history.c:222:5: [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->value, line); data/yash-2.50/history.c:880:14: [4] (format) vfwprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. result = vfwprintf(histfile, format, ap); data/yash-2.50/job.c:781:11: [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. result = fprintf(f, gt("[%zu] %c %-20s %ls\n"), data/yash-2.50/job.c:800:11: [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. result = fprintf(f, gt("[%zu] %c %5jd %-20s %ls\n"), data/yash-2.50/job.c:814:15: [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. result = fprintf(f, gt(" %5jd %-20s | %ls\n"), data/yash-2.50/job.c:864:6: [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, gt("The process was killed by SIG%ls: %s\n"), data/yash-2.50/job.c:867:6: [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, gt("The process was killed by SIG%ls\n"), data/yash-2.50/lineedit/complete.c:477:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, format, ap); data/yash-2.50/lineedit/complete.h:194:35: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((nonnull,format(printf,1,2))); data/yash-2.50/lineedit/editing.c:555:2: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. wcscpy(h->contents, main_history_value); data/yash-2.50/mail.c:281:2: [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(mf->mf_filename, path); data/yash-2.50/parser.c:567:40: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((nonnull(1,2),format(printf,2,3))); data/yash-2.50/parser.c:852:2: [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, gt("syntax error: ")); data/yash-2.50/parser.c:854:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, gt(format), ap); data/yash-2.50/path.c:77:12: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access(path, F_OK) == 0; data/yash-2.50/path.c:291:6: [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(path, dir); data/yash-2.50/path.c:294:6: [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(path + dirlen, name); data/yash-2.50/path.c:297:6: [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(path, name); data/yash-2.50/path.c:650:29: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. p = wglob_parse_pattern(wcscpy(savepattern, pattern), flags); data/yash-2.50/path.c:757:32: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. result->value.literal.wname = wcscpy(pat, value); data/yash-2.50/strbuf.c:276:18: [4] (format) vsnprintf: 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. int result = vsnprintf(&buf->contents[buf->length], rest, format, ap); data/yash-2.50/strbuf.c:289:11: [4] (format) vsnprintf: 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. result = vsnprintf(&buf->contents[buf->length], rest, format, copyap); data/yash-2.50/strbuf.c:461:11: [4] (format) vswprintf: Potential format string problem (CWE-134). Make format string constant. result = vswprintf(&buf->contents[buf->length], rest, format, copyap); data/yash-2.50/strbuf.h:105:40: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((nonnull(1,2),format(printf,2,0))); data/yash-2.50/strbuf.h:108:40: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((nonnull(1,2),format(printf,2,3))); data/yash-2.50/strbuf.h:185:64: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((nonnull(1),malloc,warn_unused_result,format(printf,1,0))); data/yash-2.50/strbuf.h:187:64: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((nonnull(1),malloc,warn_unused_result,format(printf,1,2))); data/yash-2.50/tests/ptwrap.c:209:5: [4] (shell) execvp: 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. execvp(argv[0], argv); data/yash-2.50/tests/resetsig.c:40:5: [4] (shell) execvp: 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. execvp(argv[1], &argv[1]); data/yash-2.50/util.c:257:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, gt(format), ap); data/yash-2.50/util.c:261:2: [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, data/yash-2.50/util.c:279:14: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. result = vprintf(format, ap); data/yash-2.50/util.h:267:27: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((format(printf,2,3))); data/yash-2.50/util.h:270:27: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((format(printf,1,2))); data/yash-2.50/variable.c:2575:6: [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, gt("%ls: `-%lc' is not a valid option\n"), data/yash-2.50/variable.c:2597:4: [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, data/yash-2.50/yash.c:111:6: [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, data/yash-2.50/yash.c:115:6: [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, data/yash-2.50/yash.c:546:7: [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, gt("Use `exit' to leave the shell.\n")); data/yash-2.50/yash.c:617:2: [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, data/yash-2.50/yash.c:622:2: [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, gt(" Use `exit' again to exit anyway.\n")); data/yash-2.50/lineedit/terminfo.c:319:10: [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(VAR_LINES) == NULL) data/yash-2.50/lineedit/terminfo.c:321:10: [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(VAR_COLUMNS) == NULL) data/yash-2.50/variable.c:338:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand((unsigned) time(NULL) ^ (unsigned) shell_pid << 17); data/yash-2.50/variable.c:360: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. const char *pwd = getenv(VAR_PWD); data/yash-2.50/variable.c:1104:7: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand((unsigned) seed); data/yash-2.50/arith.c:283: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 name[word->length + 1]; data/yash-2.50/arith.c:302:3: [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 name[value->v_var.length + 1]; data/yash-2.50/arith.c:975: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 wordstr[word->length + 1]; data/yash-2.50/arith.c:1015:2: [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 namestr[name->length + 1]; data/yash-2.50/common.h:58:19: [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. #define ARGV(i) ((wchar_t *) argv[i]) data/yash-2.50/exec.c:1287: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 *mbsargv[argc + 1]; data/yash-2.50/exec.c:1381: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 *args[argc + 3]; data/yash-2.50/exec.c:1642:30: [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). int fd = move_to_shellfd(open(path, O_RDONLY)); data/yash-2.50/exec.c:2004:30: [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). int fd = move_to_shellfd(open(path, O_RDONLY)); data/yash-2.50/expand.c:793:6: [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 *) values[0])[0] == L'\0' && values[1] == NULL)) data/yash-2.50/history.c:517: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). int fd = open(mbshistfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); data/yash-2.50/history.c:1472: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[80]; data/yash-2.50/history.c:1566:27: [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). fd = move_to_shellfd(open(temp, O_RDONLY)); data/yash-2.50/history.c:1809:6: [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(mbsfilename, "r"); data/yash-2.50/history.c:1840:6: [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(mbsfilename, "w"); data/yash-2.50/lineedit/complete.c:1158:2: [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 value[common_prefix_length + 1]; data/yash-2.50/lineedit/complete.c:1202:2: [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 value[valuelen + 1]; data/yash-2.50/lineedit/editing.c:191:8: [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. static wchar_t *kill_ring[KILL_RING_SIZE]; data/yash-2.50/lineedit/editing.c:2852: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 aliasname[3] = { L'_', c, L'\0', }; data/yash-2.50/lineedit/editing.c:2928:6: [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(tempfile, "r"); data/yash-2.50/lineedit/editing.c:3238: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 s[count + 1]; data/yash-2.50/parser.c:866: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 token[length + 1]; data/yash-2.50/parser.c:3852: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(save_heredocs, pr->pending_heredocs.contents, sizeof save_heredocs); data/yash-2.50/path.c:288: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 path[dirlen + namelen + 3]; data/yash-2.50/path.c:336:7: [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). fd = open(buf.contents, O_RDWR | O_CREAT | O_EXCL, mode); data/yash-2.50/path.c:648: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 savepattern[wcslen(pattern) + 1]; data/yash-2.50/plist.c:160: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(list->contents + i, a, an * sizeof (void *)); data/yash-2.50/redir.c:277:26: [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). ttyfd = move_to_shellfd(open("/dev/tty", O_RDWR)); data/yash-2.50/redir.c:497: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). int fd = open(path, oflag, mode); data/yash-2.50/redir.c:501:7: [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). fd = open(path, oflag & ~(O_CREAT | O_EXCL | O_TRUNC), mode); data/yash-2.50/redir.c:788:7: [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). fd = open("/dev/null", O_RDONLY); data/yash-2.50/redir.c:939:10: [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). fd = open("/dev/null", O_RDONLY); data/yash-2.50/sig.c:246:8: [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. static wchar_t *trap_command[MAXSIGIDX]; data/yash-2.50/sig.c:255:8: [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. static wchar_t *rttrap_command[RTSIZE]; data/yash-2.50/strbuf.c:117: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(buf->contents + i, s, sn); data/yash-2.50/tests/checkfg.c:24: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). int ttyfd = open("/dev/tty", O_RDWR | O_NOCTTY | O_NONBLOCK); data/yash-2.50/tests/ptwrap.c:78: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). int fd = open(pathname, O_RDWR | O_NOCTTY); data/yash-2.50/tests/ptwrap.c:88: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 buffer[BUFSIZ]; data/yash-2.50/tests/ptwrap.c:185:20: [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). int slave_fd = open(slave_name, O_RDWR); data/yash-2.50/util.c:72:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return memcpy(result, s, len); data/yash-2.50/variable.c:61:14: [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. static const wchar_t *const path_variables[PA_count] = { data/yash-2.50/variable.c:74: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 **paths[PA_count]; data/yash-2.50/xfnmatch.c:167:2: [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 buf[p - pat + 1]; data/yash-2.50/yash.c:203:33: [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). input.fd = move_to_shellfd(open(inputname, O_RDONLY)); data/yash-2.50/yash.c:339:30: [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). int fd = move_to_shellfd(open(path, O_RDONLY)); data/yash-2.50/alias.c:75:46: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. const wchar_t *nameandvalue, const wchar_t *equal, bool global) data/yash-2.50/alias.c:133:46: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. const wchar_t *nameandvalue, const wchar_t *equal, bool global) data/yash-2.50/alias.c:135:42: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. assert(wcschr(nameandvalue, L'=') == equal); data/yash-2.50/alias.c:138:23: [1] (buffer) wcslen: 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). size_t valuelen = wcslen(equal + 1); data/yash-2.50/arith.c:976:5: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(wordstr, word->contents, word->length); data/yash-2.50/arith.c:1206:7: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (equal) data/yash-2.50/arith.c:1209:9: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ? equal ? TT_LESSLESSEQUAL : TT_LESSLESS data/yash-2.50/arith.c:1210:9: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. : equal ? TT_LESSEQUAL : TT_LESS; data/yash-2.50/arith.c:1220:7: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (equal) data/yash-2.50/arith.c:1223:9: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ? equal ? TT_GREATERGREATEREQUAL : TT_GREATERGREATER data/yash-2.50/arith.c:1224:9: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. : equal ? TT_GREATEREQUAL : TT_GREATER; data/yash-2.50/expand.c:599:16: [1] (buffer) wcslen: 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). usernamelen = wcslen(s); data/yash-2.50/expand.c:730:16: [1] (buffer) wcslen: 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). size_t len = wcslen(v.values[0]); data/yash-2.50/expand.c:926:20: [1] (buffer) wcslen: 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). size_t len = wcslen(values[i]); data/yash-2.50/expand.c:966:16: [1] (buffer) wcslen: 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). ssize_t len = wcslen(s); data/yash-2.50/expand.c:1157:15: [1] (buffer) wcslen: 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). size_t len = wcslen(slist[i]); data/yash-2.50/expand.c:1243:22: [1] (buffer) wcslen: 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). size_t taillen = wcslen(splitpoints.contents[lastelemindex]); data/yash-2.50/expand.c:1336:15: [1] (buffer) wcslen: 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). wordlen = wcslen(word); data/yash-2.50/history.c:216:10: [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). add(strlen(line), 1), sizeof *new->value); data/yash-2.50/history.c:620:15: [1] (buffer) wcslen: 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). size_t len = wcslen(&buf->contents[buf->length]); data/yash-2.50/history.c:1503:41: [1] (buffer) wcslen: 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). wb_replace(&buf, p - buf.contents, wcslen(old), new, SIZE_MAX); data/yash-2.50/input.c:137:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t readcount = read(info->fd, info->buf, info->bufsize); data/yash-2.50/lineedit/complete.c:1147:18: [1] (buffer) wcslen: 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). size_t cpl = wcslen(value); data/yash-2.50/lineedit/complete.c:1192:11: [1] (buffer) wcslen: 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). srclen = wcslen(ctxt->src); data/yash-2.50/lineedit/complete.c:1203:2: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(value, cand->origvalue + srclen, valuelen); data/yash-2.50/lineedit/complete.c:1208:19: [1] (buffer) wcslen: 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). assert(srclen <= wcslen(cand->origvalue)); data/yash-2.50/lineedit/compparse.c:117:12: [1] (buffer) wcslen: 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). assert(wcslen(le_main_buffer.contents) == le_main_buffer.length); data/yash-2.50/lineedit/compparse.c:1238:26: [1] (buffer) wcslen: 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). assert(buf.length <= wcslen(s)); data/yash-2.50/lineedit/editing.c:511:5: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(e->contents, le_main_buffer.contents, len); data/yash-2.50/lineedit/editing.c:552:7: [1] (buffer) wcslen: 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). add(wcslen(main_history_value), 1), sizeof *h->contents); data/yash-2.50/lineedit/editing.c:553:33: [1] (buffer) wcslen: 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). assert(save_undo_save_index <= wcslen(main_history_value)); data/yash-2.50/lineedit/editing.c:2771:38: [1] (buffer) wcslen: 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). range.start = range.end = lastcmd + wcslen(lastcmd); data/yash-2.50/lineedit/editing.c:3269:19: [1] (buffer) wcslen: 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). size_t slen = wcslen(s); data/yash-2.50/lineedit/keymap.c:517:56: [1] (buffer) wcslen: 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 ((tg.type & TG_EXACTMATCH) && tg.matchlength == wcslen(keyseq)) { data/yash-2.50/lineedit/lineedit.c:205:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch (read(STDIN_FILENO, &c, 1)) { data/yash-2.50/lineedit/trietest.c:15: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). trieget_T tg = trie_get(t, key, strlen(key)); data/yash-2.50/mail.c:280: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). add(strlen(path), 1), sizeof *mf->mf_filename); data/yash-2.50/parser.c:867:5: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(token, &ps->src.contents[ps->index], length); data/yash-2.50/parser.c:2184:51: [1] (buffer) wcslen: 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). wmemmove(first_token->wu_string, &nameend[1], wcslen(&nameend[1]) + 1); data/yash-2.50/path.c:234:46: [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). return (pwd != NULL) ? xrealloc(pwd, add(strlen(pwd), 1)) : NULL; data/yash-2.50/path.c:285:22: [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). size_t namelen = strlen(name); data/yash-2.50/path.c:287: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). size_t dirlen = strlen(dir); data/yash-2.50/path.c:331:40: [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). size_t maxlen = _POSIX_NAME_MAX + 5 - strlen(suffix); data/yash-2.50/path.c:401: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). size_t namelen = strlen(name), pathlen = strlen(path); data/yash-2.50/path.c:401: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). size_t namelen = strlen(name), pathlen = strlen(path); data/yash-2.50/path.c:648:25: [1] (buffer) wcslen: 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). wchar_t savepattern[wcslen(pattern) + 1]; data/yash-2.50/path.c:755:9: [1] (buffer) wcslen: 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). assert(wcslen(value) <= wcslen(pat)); data/yash-2.50/path.c:755:26: [1] (buffer) wcslen: 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). assert(wcslen(value) <= wcslen(pat)); data/yash-2.50/path.c:1230:38: [1] (buffer) wcslen: 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). wchar_t *const result = xmalloce(wcslen(path), 1, sizeof *result); data/yash-2.50/path.c:1578:19: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t mode = umask(0); data/yash-2.50/path.c:1579:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(mode); data/yash-2.50/path.c:1636:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask((mode_t) (mask & (S_IRWXU | S_IRWXG | S_IRWXO))); data/yash-2.50/path.c:1641:24: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t origmask = ~umask(0); data/yash-2.50/path.c:1711:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(~newmask); data/yash-2.50/path.c:1715:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(~origmask); data/yash-2.50/redir.c:795: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). size_t len = strlen(s); data/yash-2.50/strbuf.c:71: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). buf->length = buf->maxlength = strlen(s); data/yash-2.50/strbuf.c:341:36: [1] (buffer) wcslen: 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->length = buf->maxlength = wcslen(s); data/yash-2.50/strbuf.c:625:23: [1] (buffer) wcslen: 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). ccount = add(ccount, wcslen(array[elemcount])); data/yash-2.50/strbuf.c:627:27: [1] (buffer) wcslen: 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). ccount = add(ccount, mul(wcslen(padding), elemcount - 1)); data/yash-2.50/tests/ptwrap.c:111:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size = read(channel->from_fd, channel->buffer, BUFSIZ); data/yash-2.50/util.c:68: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). size_t len = strlen(s); data/yash-2.50/variable.c:2850:34: [1] (buffer) wcslen: 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). sb_ccat_repeat(split, true, wcslen(line)); data/yash-2.50/xfnmatch.c:532:14: [1] (buffer) wcslen: 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). slen += wcslen(s); data/yash-2.50/xfnmatch.c:535:16: [1] (buffer) wcslen: 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). size_t slen = wcslen(s); data/yash-2.50/xfnmatch.c:564:19: [1] (buffer) wcslen: 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). result.end = wcslen(s); data/yash-2.50/xfnmatch.c:575:25: [1] (buffer) wcslen: 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). return (wchar_t *) s + wcslen(s); data/yash-2.50/xgetopt.c:187:33: [1] (buffer) wcslen: 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). assert((size_t) charindex < wcslen(arg)); ANALYSIS SUMMARY: Hits = 161 Lines analyzed = 44782 in approximately 1.11 seconds (40321 lines/second) Physical Source Lines of Code (SLOC) = 33211 Hits@level = [0] 77 [1] 68 [2] 45 [3] 5 [4] 43 [5] 0 Hits@level+ = [0+] 238 [1+] 161 [2+] 93 [3+] 48 [4+] 43 [5+] 0 Hits/KSLOC@level+ = [0+] 7.1663 [1+] 4.84779 [2+] 2.80028 [3+] 1.4453 [4+] 1.29475 [5+] 0 Dot directories skipped = 2 (--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.