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/stterm-0.8.4/arg.h Examining data/stterm-0.8.4/config.def.h Examining data/stterm-0.8.4/st.c Examining data/stterm-0.8.4/st.h Examining data/stterm-0.8.4/win.h Examining data/stterm-0.8.4/x.c FINAL RESULTS: data/stterm-0.8.4/st.c:660: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, errstr, ap); data/stterm-0.8.4/st.c:713:2: [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(prog, args); data/stterm-0.8.4/st.c:756:6: [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. if (system(cmd) != 0) data/stterm-0.8.4/st.c:679:12: [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 ((sh = getenv("SHELL")) == NULL) data/stterm-0.8.4/st.c:126: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 trantbl[4]; /* charset table translation */ data/stterm-0.8.4/st.c:136: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[ESC_BUF_SIZ]; /* raw string */ data/stterm-0.8.4/st.c:141: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 mode[2]; data/stterm-0.8.4/st.c:151: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 *args[STR_ARG_SIZ]; data/stterm-0.8.4/st.c:739: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 cmd[_POSIX_ARG_MAX], **p, *q, *s; data/stterm-0.8.4/st.c:744: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(cmd, stty_args, n); data/stterm-0.8.4/st.c:751:3: [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(q, s, n); data/stterm-0.8.4/st.c:768: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). 1 : open(out, O_WRONLY | O_CREAT, 0666); data/stterm-0.8.4/st.c:776:16: [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). if ((cmdfd = open(line, O_RDWR)) < 0) data/stterm-0.8.4/st.c:824: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[BUFSIZ]; data/stterm-0.8.4/st.c:1191: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 *vt100_0[62] = { /* 0x41 - 0x7e */ data/stterm-0.8.4/st.c:1603: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[40]; data/stterm-0.8.4/st.c:1850:34: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). par = (narg = strescseq.narg) ? atoi(strescseq.args[0]) : 0; data/stterm-0.8.4/st.c:1878:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). j = (narg > 1) ? atoi(strescseq.args[1]) : -1; data/stterm-0.8.4/st.c:2014: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[UTF_SIZ]; data/stterm-0.8.4/st.c:2297: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 c[UTF_SIZ]; data/stterm-0.8.4/x.c:369: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[40]; data/stterm-0.8.4/x.c:1576: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[sizeof(long) * 8 + 1]; data/stterm-0.8.4/x.c:1790: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], *customkey; data/stterm-0.8.4/st.c:376: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 in_len = strlen(src); data/stterm-0.8.4/st.c:742: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). if ((n = strlen(stty_args)) > sizeof(cmd)-1) data/stterm-0.8.4/st.c:748: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). if ((n = strlen(s)) > siz-1) data/stterm-0.8.4/st.c:829:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(cmdfd, buf+buflen, LEN(buf)-buflen); data/stterm-0.8.4/st.c:1647:21: [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). ttywrite(vtiden, strlen(vtiden), 0); data/stterm-0.8.4/st.c:2006: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). tprinter(ptr, strlen(ptr)); data/stterm-0.8.4/st.c:2191: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). ttywrite(vtiden, strlen(vtiden), 0); data/stterm-0.8.4/st.c:2263: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). ttywrite(vtiden, strlen(vtiden), 0); data/stterm-0.8.4/x.c:328: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). ttywrite(arg->s, strlen(arg->s), 1); data/stterm-0.8.4/x.c:654:24: [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). (uchar *)seltext, strlen(seltext)); data/stterm-0.8.4/x.c:936:3: [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(ascii_printable), &extents); data/stterm-0.8.4/x.c:947: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). f->width = DIVCEIL(extents.xOff, strlen(ascii_printable)); data/stterm-0.8.4/x.c:1813: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). ttywrite(customkey, strlen(customkey), 1); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 5332 in approximately 0.14 seconds (39281 lines/second) Physical Source Lines of Code (SLOC) = 4312 Hits@level = [0] 37 [1] 13 [2] 19 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 73 [1+] 36 [2+] 23 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 16.9295 [1+] 8.34879 [2+] 5.33395 [3+] 0.927644 [4+] 0.695733 [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.