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/zssh-1.5c.debian.1/test/local_tty_test.c Examining data/zssh-1.5c.debian.1/test/ttydump.c Examining data/zssh-1.5c.debian.1/test/ttyprint.c Examining data/zssh-1.5c.debian.1/zmodem.c Examining data/zssh-1.5c.debian.1/escape.c Examining data/zssh-1.5c.debian.1/fun.h Examining data/zssh-1.5c.debian.1/signal.c Examining data/zssh-1.5c.debian.1/zmodem_act.c Examining data/zssh-1.5c.debian.1/escape_multi.c Examining data/zssh-1.5c.debian.1/pc_test_escapes.c Examining data/zssh-1.5c.debian.1/doit.c Examining data/zssh-1.5c.debian.1/fake_readline/history.h Examining data/zssh-1.5c.debian.1/fake_readline/readline.c Examining data/zssh-1.5c.debian.1/fake_readline/readline.h Examining data/zssh-1.5c.debian.1/init.c Examining data/zssh-1.5c.debian.1/quote_removal.c Examining data/zssh-1.5c.debian.1/main.c Examining data/zssh-1.5c.debian.1/misc.c Examining data/zssh-1.5c.debian.1/globbing.c Examining data/zssh-1.5c.debian.1/util.c Examining data/zssh-1.5c.debian.1/parse.h Examining data/zssh-1.5c.debian.1/zssh.h Examining data/zssh-1.5c.debian.1/version.h Examining data/zssh-1.5c.debian.1/split_words.c Examining data/zssh-1.5c.debian.1/acconfig.h Examining data/zssh-1.5c.debian.1/tilde_expansion.c Examining data/zssh-1.5c.debian.1/openpty.c Examining data/zssh-1.5c.debian.1/completion.c FINAL RESULTS: data/zssh-1.5c.debian.1/doit.c:89:4: [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(shav[0],argv); data/zssh-1.5c.debian.1/init.c:82:4: [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. printf(ZSSH_VERSION); data/zssh-1.5c.debian.1/misc.c:54: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, s1, s2); data/zssh-1.5c.debian.1/misc.c:68: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, s1, s2); data/zssh-1.5c.debian.1/openpty.c:220:11: [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. ok = access(gl_slavename, R_OK | W_OK) == 0; data/zssh-1.5c.debian.1/test/local_tty_test.c:24: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(stderr, s1, s2); data/zssh-1.5c.debian.1/test/ttydump.c:16: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(stderr, s1, s2); data/zssh-1.5c.debian.1/test/ttyprint.c:16: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(stderr, s1, s2); data/zssh-1.5c.debian.1/zmodem_act.c:25:7: [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], av); data/zssh-1.5c.debian.1/zmodem_act.c:123:7: [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],av); data/zssh-1.5c.debian.1/init.c:226: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 ((str = getenv("ZSSHESCAPE"))) data/zssh-1.5c.debian.1/tilde_expansion.c:21:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((str = getenv("HOME"))) data/zssh-1.5c.debian.1/zmodem.c:25:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((tmp = getenv("HOSTNAME"))) data/zssh-1.5c.debian.1/zmodem_act.c:84:13: [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. str = getenv("HOME"); data/zssh-1.5c.debian.1/doit.c:19:13: [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. unsigned char ibuf[BUFSIZ]; data/zssh-1.5c.debian.1/doit.c:38: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 obuf[BUFSIZ]; data/zssh-1.5c.debian.1/init.c:148:11: [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 str[40]; data/zssh-1.5c.debian.1/init.c:151:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(str,"C-Space"); data/zssh-1.5c.debian.1/init.c:153:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(str,"C-%c", tolower(gl_escape)); data/zssh-1.5c.debian.1/misc.c:95: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 buff[4096]; data/zssh-1.5c.debian.1/misc.c:117: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 buf[50]; data/zssh-1.5c.debian.1/openpty.c:14: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 gl_slavename[GL_SLAVENAMELEN + 1] = {0}; data/zssh-1.5c.debian.1/openpty.c:77: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). if ((gl_slave = open(gl_slavename, O_RDWR | O_NOCTTY)) < 0) data/zssh-1.5c.debian.1/openpty.c:118: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). gl_master = open(DEV_CLONE, O_RDWR); data/zssh-1.5c.debian.1/openpty.c:139:21: [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 ( (gl_slave = open(gl_slavename, O_RDWR | O_NOCTTY)) < 0 ) /* open the slave */ data/zssh-1.5c.debian.1/openpty.c:206:15: [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). gl_master = open(gl_line, O_RDWR); data/zssh-1.5c.debian.1/openpty.c:233:21: [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 ( (gl_slave = open(gl_slavename, O_RDWR | O_NOCTTY)) < 0) data/zssh-1.5c.debian.1/openpty.c:330:8: [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 (open("/dev/tty", O_RDWR) >= 0) data/zssh-1.5c.debian.1/openpty.c:338:21: [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 ( (gl_slave = open(gl_slavename, O_RDWR)) < 0 ) data/zssh-1.5c.debian.1/split_words.c:20: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(pt, *argv, *argc * sizeof(char *)); data/zssh-1.5c.debian.1/test/local_tty_test.c:65: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 buff[20]; data/zssh-1.5c.debian.1/test/ttydump.c:54: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 buff[30]; data/zssh-1.5c.debian.1/test/ttydump.c:58:9: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). tty = fopen("/dev/tty", "w"); data/zssh-1.5c.debian.1/test/ttydump.c:70:8: [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("output.dump", O_CREAT | O_TRUNC | O_WRONLY, 0666); data/zssh-1.5c.debian.1/test/ttyprint.c:54: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 buff[30]; data/zssh-1.5c.debian.1/test/ttyprint.c:61:8: [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("local_tty_test.reference_output", O_RDONLY); data/zssh-1.5c.debian.1/completion.c:105: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/zssh-1.5c.debian.1/completion.c:141: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 + 1); data/zssh-1.5c.debian.1/doit.c:49:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). cc = read(gl_master,obuf,sizeof(obuf)); data/zssh-1.5c.debian.1/init.c:181: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). if (i+1 == ac || strlen(av[i+1]) != 2 || set_escape(av[i+1]) < 0) data/zssh-1.5c.debian.1/main.c:51:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(40000); data/zssh-1.5c.debian.1/main.c:89:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). *cc = read(0,ibuf,BUFSIZ); data/zssh-1.5c.debian.1/main.c:152:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(500); data/zssh-1.5c.debian.1/misc.c:101:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). tot += i = read(fd,buff,4096); data/zssh-1.5c.debian.1/misc.c:102:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(50); data/zssh-1.5c.debian.1/misc.c:130:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(0, buf, 49) <= 0) data/zssh-1.5c.debian.1/openpty.c:68:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(gl_slavename, name, GL_SLAVENAMELEN); data/zssh-1.5c.debian.1/openpty.c:124:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(gl_slavename, ttyptr, GL_SLAVENAMELEN); data/zssh-1.5c.debian.1/openpty.c:196: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). pty = &gl_line[strlen("/dev/ptyp")]; data/zssh-1.5c.debian.1/openpty.c:199: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). gl_line[strlen("/dev/pty")] = *bank; data/zssh-1.5c.debian.1/openpty.c:209:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(gl_slavename, gl_line, GL_SLAVENAMELEN); data/zssh-1.5c.debian.1/openpty.c:210: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). gl_slavename[strlen("/dev/")] = 't'; data/zssh-1.5c.debian.1/test/local_tty_test.c:67:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(fd, buff, 1)) >= 0) data/zssh-1.5c.debian.1/test/ttydump.c:73:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(0, buff, 1)) > 0) data/zssh-1.5c.debian.1/test/ttyprint.c:64:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(fd, buff, 1)) > 0) data/zssh-1.5c.debian.1/tilde_expansion.c:54: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). i += strlen(tmp); data/zssh-1.5c.debian.1/util.c:39: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). len = min(strlen(str),n); data/zssh-1.5c.debian.1/util.c:57: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). len1 = strlen(str1); data/zssh-1.5c.debian.1/util.c:58: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). len2 = strlen(str2); ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 2922 in approximately 0.10 seconds (29881 lines/second) Physical Source Lines of Code (SLOC) = 2024 Hits@level = [0] 86 [1] 23 [2] 22 [3] 4 [4] 10 [5] 0 Hits@level+ = [0+] 145 [1+] 59 [2+] 36 [3+] 14 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 71.6403 [1+] 29.1502 [2+] 17.7866 [3+] 6.917 [4+] 4.94071 [5+] 0 Symlinks skipped = 2 (--allowlink overrides but see doc for security issue) 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.