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/libedit-3.1-20191231/examples/fileman.c Examining data/libedit-3.1-20191231/examples/tc1.c Examining data/libedit-3.1-20191231/examples/wtc1.c Examining data/libedit-3.1-20191231/src/editline/readline.h Examining data/libedit-3.1-20191231/src/sig.c Examining data/libedit-3.1-20191231/src/history.c Examining data/libedit-3.1-20191231/src/common.c Examining data/libedit-3.1-20191231/src/hist.h Examining data/libedit-3.1-20191231/src/keymacro.h Examining data/libedit-3.1-20191231/src/vis.h Examining data/libedit-3.1-20191231/src/refresh.h Examining data/libedit-3.1-20191231/src/filecomplete.h Examining data/libedit-3.1-20191231/src/wcsdup.c Examining data/libedit-3.1-20191231/src/strlcpy.c Examining data/libedit-3.1-20191231/src/tty.h Examining data/libedit-3.1-20191231/src/terminal.c Examining data/libedit-3.1-20191231/src/histedit.h Examining data/libedit-3.1-20191231/src/map.h Examining data/libedit-3.1-20191231/src/parse.h Examining data/libedit-3.1-20191231/src/vi.c Examining data/libedit-3.1-20191231/src/literal.h Examining data/libedit-3.1-20191231/src/eln.c Examining data/libedit-3.1-20191231/src/el.h Examining data/libedit-3.1-20191231/src/prompt.c Examining data/libedit-3.1-20191231/src/chared.h Examining data/libedit-3.1-20191231/src/search.c Examining data/libedit-3.1-20191231/src/read.c Examining data/libedit-3.1-20191231/src/chartype.h Examining data/libedit-3.1-20191231/src/vis.c Examining data/libedit-3.1-20191231/src/refresh.c Examining data/libedit-3.1-20191231/src/hist.c Examining data/libedit-3.1-20191231/src/keymacro.c Examining data/libedit-3.1-20191231/src/sig.h Examining data/libedit-3.1-20191231/src/unvis.c Examining data/libedit-3.1-20191231/src/terminal.h Examining data/libedit-3.1-20191231/src/map.c Examining data/libedit-3.1-20191231/src/emacs.c Examining data/libedit-3.1-20191231/src/tokenizern.c Examining data/libedit-3.1-20191231/src/sys.h Examining data/libedit-3.1-20191231/src/tty.c Examining data/libedit-3.1-20191231/src/filecomplete.c Examining data/libedit-3.1-20191231/src/parse.c Examining data/libedit-3.1-20191231/src/strlcat.c Examining data/libedit-3.1-20191231/src/historyn.c Examining data/libedit-3.1-20191231/src/read.h Examining data/libedit-3.1-20191231/src/search.h Examining data/libedit-3.1-20191231/src/chared.c Examining data/libedit-3.1-20191231/src/chartype.c Examining data/libedit-3.1-20191231/src/prompt.h Examining data/libedit-3.1-20191231/src/literal.c Examining data/libedit-3.1-20191231/src/tokenizer.c Examining data/libedit-3.1-20191231/src/el.c Examining data/libedit-3.1-20191231/src/readline.c FINAL RESULTS: data/libedit-3.1-20191231/examples/fileman.c:89: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 (r, s); data/libedit-3.1-20191231/examples/fileman.c:311:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (syscom, "ls -FClg %s", arg); data/libedit-3.1-20191231/examples/fileman.c:312:12: [4] (shell) system: 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. return (system (syscom)); data/libedit-3.1-20191231/examples/fileman.c:321:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (syscom, "more %s", arg); data/libedit-3.1-20191231/examples/fileman.c:322:12: [4] (shell) system: 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. return (system (syscom)); data/libedit-3.1-20191231/examples/tc1.c:283: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(av[0], (char *const *)__UNCONST(av)); data/libedit-3.1-20191231/examples/wtc1.c:249: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(nav[0],(char **)nav); data/libedit-3.1-20191231/src/el.h:152:5: [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 a; \ data/libedit-3.1-20191231/src/filecomplete.c:346:10: [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). (void)strcpy(filename, temp); data/libedit-3.1-20191231/src/keymacro.c:596: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. (void) fprintf(el->el_outfile, fmt, data/libedit-3.1-20191231/src/keymacro.c:604:13: [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. (void) fprintf(el->el_outfile, fmt, data/libedit-3.1-20191231/src/keymacro.c:620:10: [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. (void) fprintf(el->el_outfile, fmt, ct_encode_string(key, data/libedit-3.1-20191231/src/readline.c:536:11: [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). (void)strcpy(r, s); data/libedit-3.1-20191231/src/readline.c:894: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). (void)strcpy(&with[len], from); data/libedit-3.1-20191231/src/readline.c:948: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). (void)strcpy((*output) + 4, str); data/libedit-3.1-20191231/src/readline.c:1094: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). (void)strcpy(result + len, arr[i]); data/libedit-3.1-20191231/src/readline.c:1237: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(template, _history_tmp_template); data/libedit-3.1-20191231/src/refresh.c:68:13: [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. (void) fprintf b; \ data/libedit-3.1-20191231/src/terminal.c:359:11: [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). (void) strcpy(*str, cap); /* XXX strcpy is safe */ data/libedit-3.1-20191231/src/terminal.c:367:10: [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). (void) strcpy(*str = &el->el_terminal.t_buf[ data/libedit-3.1-20191231/src/terminal.c:393: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). (void) strcpy(*str = &el->el_terminal.t_buf[el->el_terminal.t_loc], data/libedit-3.1-20191231/src/terminal.c:1481:10: [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. (void) fprintf(el->el_outfile, fmts, EL_CAN_TAB ? "yes" : "no"); data/libedit-3.1-20191231/src/terminal.c:1484:10: [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. (void) fprintf(el->el_outfile, fmts, Val(T_km) ? "yes" : "no"); data/libedit-3.1-20191231/src/terminal.c:1487:10: [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. (void) fprintf(el->el_outfile, fmts, EL_HAS_MAGIC_MARGINS ? data/libedit-3.1-20191231/src/terminal.c:1491:10: [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. (void) fprintf(el->el_outfile, fmts, EL_HAS_AUTO_MARGINS ? data/libedit-3.1-20191231/src/terminal.c:1495:10: [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. (void) fprintf(el->el_outfile, fmtd, (int)el->el_tty.t_speed); data/libedit-3.1-20191231/src/terminal.c:1499:10: [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. (void) fprintf(el->el_outfile, fmtd, Val(T_li)); data/libedit-3.1-20191231/src/terminal.c:1502:10: [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. (void) fprintf(el->el_outfile, fmtd, Val(T_co)); data/libedit-3.1-20191231/src/vi.c:1041:3: [4] (shell) execlp: 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. execlp("vi", "vi", tempfile, (char *)NULL); data/libedit-3.1-20191231/src/el.c:83: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. return getenv(name); data/libedit-3.1-20191231/src/el.c:555:16: [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 ((fname = getenv("EDITRC")) == NULL) { data/libedit-3.1-20191231/src/el.c:559:15: [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 ((ptr = getenv("HOME")) == NULL) data/libedit-3.1-20191231/src/terminal.c:855: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. term = getenv("TERM"); data/libedit-3.1-20191231/examples/fileman.c:302: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 syscom[1024]; data/libedit-3.1-20191231/examples/fileman.c:441:4: [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 dir[1024], *s; data/libedit-3.1-20191231/examples/wtc1.c:66: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 dir[1024]; data/libedit-3.1-20191231/src/chared.c:72:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(vu->buf, el->el_line.buffer, size * sizeof(*vu->buf)); data/libedit-3.1-20191231/src/chared.c:90:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(k->buf, ptr, (size_t)size * sizeof(*k->buf)); data/libedit-3.1-20191231/src/chared.c:657:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(cp, prompt, (size_t)len * sizeof(*cp)); data/libedit-3.1-20191231/src/chartype.c:188: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 buf[MB_LEN_MAX]; data/libedit-3.1-20191231/src/common.c:825: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 tmpbuf[EL_BUFSIZ]; data/libedit-3.1-20191231/src/el.c:268:9: [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. const wchar_t *argv[20]; data/libedit-3.1-20191231/src/el.c:467:3: [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 *argv[3]; data/libedit-3.1-20191231/src/el.c:581:8: [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(fname, "r"); data/libedit-3.1-20191231/src/eln.c:166:9: [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. const char *argv[20]; data/libedit-3.1-20191231/src/eln.c:213:9: [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. const char *args[2]; data/libedit-3.1-20191231/src/eln.c:324:3: [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 *argv[3]; data/libedit-3.1-20191231/src/filecomplete.c:70: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 pwbuf[1024]; data/libedit-3.1-20191231/src/filecomplete.c:520:27: [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. const char *s1 = ((const char * const *)i1)[0]; data/libedit-3.1-20191231/src/filecomplete.c:521:27: [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. const char *s2 = ((const char * const *)i2)[0]; data/libedit-3.1-20191231/src/hist.c:139:2: [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(el->el_line.buffer, hp, hlen * sizeof(*hp)); data/libedit-3.1-20191231/src/history.c:431:2: [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(s, evp->str, elen * sizeof(*s)); data/libedit-3.1-20191231/src/history.c:432:2: [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(s + elen, str, slen * sizeof(*s)); data/libedit-3.1-20191231/src/history.c:788:12: [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 ((fp = fopen(fname, "r")) == NULL) data/libedit-3.1-20191231/src/history.c:897:15: [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 ((fp = fopen(fname, "w")) == NULL) data/libedit-3.1-20191231/src/keymacro.c:587: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 unparsbuf[EL_BUFSIZ]; data/libedit-3.1-20191231/src/keymacro.c:650: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 dbuf[VISUAL_WIDTH_MAX]; data/libedit-3.1-20191231/src/map.c:928:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(el->el_map.help, el_func_help, data/libedit-3.1-20191231/src/map.c:933:2: [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(el->el_map.func, el_func, sizeof(*el->el_map.func) data/libedit-3.1-20191231/src/map.c:989: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[3]; data/libedit-3.1-20191231/src/map.c:1061: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[3]; data/libedit-3.1-20191231/src/map.c:1134: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 outbuf[EL_BUFSIZ]; data/libedit-3.1-20191231/src/map.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 firstbuf[2], lastbuf[2]; data/libedit-3.1-20191231/src/map.c:1159: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 unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ]; data/libedit-3.1-20191231/src/map.c:1259: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 inbuf[EL_BUFSIZ]; data/libedit-3.1-20191231/src/map.c:1260: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 outbuf[EL_BUFSIZ]; data/libedit-3.1-20191231/src/prompt.c:60:9: [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 a[3] = L"? "; data/libedit-3.1-20191231/src/prompt.c:73:9: [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 a[1] = L""; data/libedit-3.1-20191231/src/read.c:281: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 cbuf[MB_LEN_MAX]; data/libedit-3.1-20191231/src/readline.c:532:4: [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(r, with, with_len); data/libedit-3.1-20191231/src/readline.c:695:3: [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[4]; data/libedit-3.1-20191231/src/readline.c:1225: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 template[sizeof(_history_tmp_template)]; data/libedit-3.1-20191231/src/readline.c:1226: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 buf[4096]; data/libedit-3.1-20191231/src/readline.c:1235:12: [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 ((fp = fopen(filename, "r+")) == NULL) data/libedit-3.1-20191231/src/readline.c:1238:12: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). if ((fd = mkstemp(template)) == -1) { data/libedit-3.1-20191231/src/readline.c:1406:12: [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 ((fp = fopen(filename, "a")) == NULL) data/libedit-3.1-20191231/src/readline.c:1864:9: [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 buf[2]; data/libedit-3.1-20191231/src/readline.c:1898:3: [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 arr[2]; data/libedit-3.1-20191231/src/readline.c:1965: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 fooarr[2 * sizeof(int)]; data/libedit-3.1-20191231/src/readline.c:1995: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 arr[2]; data/libedit-3.1-20191231/src/readline.c:2056: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 dest[8]; data/libedit-3.1-20191231/src/readline.c:2114: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 a[2]; data/libedit-3.1-20191231/src/readline.c:2123: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 a[2]; data/libedit-3.1-20191231/src/readline.c:2177: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 buf[2]; data/libedit-3.1-20191231/src/readline.c:2253: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 buf[64]; data/libedit-3.1-20191231/src/readline.c:2305:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(list[0], list[1], min); data/libedit-3.1-20191231/src/refresh.c:148: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 visbuf[VISUAL_WIDTH_MAX]; data/libedit-3.1-20191231/src/refresh.c:1174: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 visbuf[VISUAL_WIDTH_MAX]; data/libedit-3.1-20191231/src/search.c:214:9: [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 endcmd[2] = {'\0', '\0'}; data/libedit-3.1-20191231/src/search.c:460: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 tmpbuf[EL_BUFSIZ]; data/libedit-3.1-20191231/src/terminal.c:340: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 termbuf[TC_BUFSIZE]; data/libedit-3.1-20191231/src/terminal.c:385:2: [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(el->el_terminal.t_buf, termbuf, TC_BUFSIZE); data/libedit-3.1-20191231/src/terminal.c:841: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 buf[TC_BUFSIZE]; data/libedit-3.1-20191231/src/terminal.c:1153: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 wt_str[VISUAL_WIDTH_MAX]; data/libedit-3.1-20191231/src/terminal.c:1226: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 buf[MB_LEN_MAX +1]; data/libedit-3.1-20191231/src/terminal.c:1255: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 visbuf[VISUAL_WIDTH_MAX +1]; data/libedit-3.1-20191231/src/terminal.c:1317: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 what[8], how[8]; data/libedit-3.1-20191231/src/terminal.c:1455: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 buf[TC_BUFSIZE]; data/libedit-3.1-20191231/src/tty.c:578:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(el->el_tty.t_t, ttyperm, sizeof(ttyperm_t)); data/libedit-3.1-20191231/src/tty.c:579:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(el->el_tty.t_c, ttychar, sizeof(ttychar_t)); data/libedit-3.1-20191231/src/tty.c:901: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 new[2], old[2]; data/libedit-3.1-20191231/src/tty.c:1160:9: [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 name[EL_BUFSIZ]; data/libedit-3.1-20191231/src/tty.h:457:18: [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. typedef unsigned char ttychar_t[NN_IO][C_NCC]; data/libedit-3.1-20191231/src/unvis.c:85: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 name[7]; data/libedit-3.1-20191231/src/vi.c:119:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(el->el_line.cursor, k->buf, len * data/libedit-3.1-20191231/src/vi.c:932: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 alias_name[3]; data/libedit-3.1-20191231/src/vi.c:1017:7: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp(tempfile); data/libedit-3.1-20191231/src/vis.c:617: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 cc[2]; data/libedit-3.1-20191231/src/vis.c:632: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 cc[2]; data/libedit-3.1-20191231/src/vis.c:684: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 cc[2]; data/libedit-3.1-20191231/src/vis.c:699: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 cc[2]; data/libedit-3.1-20191231/examples/fileman.c:88:17: [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). r = xmalloc (strlen (s) + 1); data/libedit-3.1-20191231/examples/fileman.c:207: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). t = s + strlen (s) - 1; data/libedit-3.1-20191231/examples/fileman.c:277:13: [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). len = strlen (text); data/libedit-3.1-20191231/examples/tc1.c:111:13: [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 (len > strlen(dp->d_name)) data/libedit-3.1-20191231/examples/wtc1.c:88:15: [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 (mblen > strlen(dp->d_name)) data/libedit-3.1-20191231/src/chared.c:595: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). if (s == NULL || (len = wcslen(s)) == 0) data/libedit-3.1-20191231/src/chared.c:656: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). len = (ssize_t)wcslen(prompt); data/libedit-3.1-20191231/src/chartype.c:155: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). bufspace += argv[i] ? strlen(argv[i]) + 1 : 0; data/libedit-3.1-20191231/src/common.c:570:10: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(el->el_history.buf, el->el_line.buffer, data/libedit-3.1-20191231/src/common.c:642:10: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(el->el_history.buf, el->el_line.buffer, data/libedit-3.1-20191231/src/el.c:561: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). plen += strlen(ptr); data/libedit-3.1-20191231/src/filecomplete.c:120:8: [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). len = strlen(pass->pw_dir) + 1 + strlen(txt) + 1; data/libedit-3.1-20191231/src/filecomplete.c:120: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). len = strlen(pass->pw_dir) + 1 + strlen(txt) + 1; data/libedit-3.1-20191231/src/filecomplete.c:338: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). nptr = el_realloc(filename, (strlen(temp) + 1) * data/libedit-3.1-20191231/src/filecomplete.c:397: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). filename_len = filename ? strlen(filename) : 0; data/libedit-3.1-20191231/src/filecomplete.c:412: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). && strlen(entry->d_name) >= filename_len data/libedit-3.1-20191231/src/filecomplete.c:421: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). len = strlen(entry->d_name); data/libedit-3.1-20191231/src/filecomplete.c:423: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). len = strlen(dirname) + len + 1; data/libedit-3.1-20191231/src/filecomplete.c:492:14: [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). max_equal = strlen(prevstr); data/libedit-3.1-20191231/src/filecomplete.c:573:20: [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) (width - strlen(matches[thisguy])), ""); data/libedit-3.1-20191231/src/filecomplete.c:749:16: [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_len = strlen(matches[i]); data/libedit-3.1-20191231/src/filecomplete.c:768:8: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (getc(stdin) != 'y') data/libedit-3.1-20191231/src/hist.c:108:10: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(el->el_line.buffer, el->el_history.buf, data/libedit-3.1-20191231/src/hist.c:134: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). hlen = wcslen(hp) + 1; data/libedit-3.1-20191231/src/hist.c:185:17: [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(ptr); data/libedit-3.1-20191231/src/history.c:69:20: [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 Strlen(s) strlen(s) data/libedit-3.1-20191231/src/history.c:73:26: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). #define Strncpy(d, s, n) strncpy(d, s, n) data/libedit-3.1-20191231/src/history.c:74:26: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. #define Strncat(d, s, n) strncat(d, s, n) data/libedit-3.1-20191231/src/history.c:87: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). #define Strlen(s) wcslen(s) data/libedit-3.1-20191231/src/history.c:91:26: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). #define Strncpy(d, s, n) wcsncpy(d, s, n) data/libedit-3.1-20191231/src/history.c:92:26: [1] (buffer) wcsncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or automatically resizing strings. #define Strncat(d, s, n) wcsncat(d, s, n) data/libedit-3.1-20191231/src/history.c:867: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). len = strlen(str) * 4 + 1; data/libedit-3.1-20191231/src/parse.c:118:10: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(tprog, argv[0], l); data/libedit-3.1-20191231/src/read.c:287:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((num_read = read(el->el_infd, cbuf + cbp, (size_t)1)) == -1) { data/libedit-3.1-20191231/src/readline.c:239:8: [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). len = strlen(p->pw_dir) + sizeof("/.history"); data/libedit-3.1-20191231/src/readline.c:272:26: [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). memmove(p, p + 2, 1 + strlen(p + 2)); data/libedit-3.1-20191231/src/readline.c:511:8: [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). len = strlen(str); data/libedit-3.1-20191231/src/readline.c:512:13: [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). with_len = strlen(with); data/libedit-3.1-20191231/src/readline.c:513:13: [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). what_len = strlen(what); data/libedit-3.1-20191231/src/readline.c:878:16: [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). from_len = strlen(from); data/libedit-3.1-20191231/src/readline.c:942:23: [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). *output = el_calloc(strlen(str) + 4 + 1, sizeof(**output)); data/libedit-3.1-20191231/src/readline.c:987:11: [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). len = strlen(&str[j + 1]) + 1; data/libedit-3.1-20191231/src/readline.c:1027: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). len = strlen(tmp); data/libedit-3.1-20191231/src/readline.c:1087: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). len += strlen(arr[i]) + 1; data/libedit-3.1-20191231/src/readline.c:1095: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). len += strlen(arr[i]); data/libedit-3.1-20191231/src/readline.c:1660:11: [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 += strlen(ev.str) * sizeof(*ev.str); data/libedit-3.1-20191231/src/readline.c:2021:14: [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 (int)strlen(text); data/libedit-3.1-20191231/src/readline.c:2202:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). num_read = read(el->el_infd, &ch, (size_t)1); data/libedit-3.1-20191231/src/readline.c:2210:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). num_read = read(el->el_infd, &ch, 1); data/libedit-3.1-20191231/src/readline.c:2215:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). num_read = read(el->el_infd, &ch, 1); data/libedit-3.1-20191231/src/refresh.c:357: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). terminal_clear_EOL(el, (int) wcslen(el->el_display[i])); data/libedit-3.1-20191231/src/search.c:187:11: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(el->el_search.patbuf, el->el_line.buffer, data/libedit-3.1-20191231/src/search.c:191: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). el->el_search.patlen = wcslen(el->el_search.patbuf); data/libedit-3.1-20191231/src/search.c:491:11: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(tmpbuf, el->el_search.patbuf, data/libedit-3.1-20191231/src/search.c:495:11: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(&el->el_search.patbuf[2], tmpbuf, data/libedit-3.1-20191231/src/search.c:509:10: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(el->el_search.patbuf, tmpbuf, EL_BUFSIZ - 1); data/libedit-3.1-20191231/src/strlcat.c:63:17: [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(dlen + strlen(s)); data/libedit-3.1-20191231/src/terminal.c:350: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). clen = strlen(cap); data/libedit-3.1-20191231/src/terminal.c:352:28: [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). tlen = *str == NULL ? 0 : strlen(*str); data/libedit-3.1-20191231/src/terminal.c:1322:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(what, ct_encode_string(argv[1], &el->el_scratch), sizeof(what)); data/libedit-3.1-20191231/src/terminal.c:1324:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(how, ct_encode_string(argv[2], &el->el_scratch), sizeof(how)); data/libedit-3.1-20191231/src/tty.c:1166:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, ct_encode_string(*argv++, &el->el_scratch), sizeof(name)); data/libedit-3.1-20191231/src/tty.c:1207: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). strlen(el->el_tty.t_t[z][m->m_type].t_name); data/libedit-3.1-20191231/src/tty.c:1221: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). cu = strlen(m->m_name) + (x != '\0') + 1; data/libedit-3.1-20191231/src/vi.c:963:11: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) wcsncpy(el->el_history.buf, el->el_line.buffer, data/libedit-3.1-20191231/src/vi.c:1028:2: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(line, el->el_line.buffer, len); data/libedit-3.1-20191231/src/vi.c:1032:8: [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). len = strlen(cp); data/libedit-3.1-20191231/src/vi.c:1048:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). st = read(fd, cp, TMP_BUFSIZ - 1); data/libedit-3.1-20191231/src/vis.c:359:8: [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). len = strlen(src); data/libedit-3.1-20191231/src/vis.c:369:13: [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). d = dst + wcslen(dst); data/libedit-3.1-20191231/src/vis.c:536:8: [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). len = wcslen(start); data/libedit-3.1-20191231/src/vis.c:537:28: [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). maxolen = dlen ? *dlen : (wcslen(start) * MB_LEN_MAX + 1); data/libedit-3.1-20191231/src/vis.c:601: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). mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr); data/libedit-3.1-20191231/src/wcsdup.c:34:8: [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). len = wcslen(str) + 1; ANALYSIS SUMMARY: Hits = 185 Lines analyzed = 23399 in approximately 0.61 seconds (38070 lines/second) Physical Source Lines of Code (SLOC) = 16095 Hits@level = [0] 161 [1] 74 [2] 78 [3] 4 [4] 29 [5] 0 Hits@level+ = [0+] 346 [1+] 185 [2+] 111 [3+] 33 [4+] 29 [5+] 0 Hits/KSLOC@level+ = [0+] 21.4974 [1+] 11.4943 [2+] 6.89655 [3+] 2.05033 [4+] 1.8018 [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.