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/vtprint-2.0.2/arglist.c Examining data/vtprint-2.0.2/arglist.h Examining data/vtprint-2.0.2/escape.c Examining data/vtprint-2.0.2/escape.h Examining data/vtprint-2.0.2/template.c Examining data/vtprint-2.0.2/template.h Examining data/vtprint-2.0.2/termstate.c Examining data/vtprint-2.0.2/termstate.h Examining data/vtprint-2.0.2/vtprint.c FINAL RESULTS: data/vtprint-2.0.2/vtprint.c:443: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 (env, tmp); data/vtprint-2.0.2/vtprint.c:190:13: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt (args->argc, args->argv, "hwlvdDbBcCeEfFnNqQT:tL:V:"); data/vtprint-2.0.2/vtprint.c:214:39: [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. termname = getenv ("TERM"); data/vtprint-2.0.2/vtprint.c:343:47: [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 ((!termname)||(!*termname)) termname = getenv ("TERM"); data/vtprint-2.0.2/vtprint.c:432:11: [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. tmp = getenv (vtbasename); data/vtprint-2.0.2/vtprint.c:433:21: [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) tmp = getenv ("VTPRINT"); data/vtprint-2.0.2/vtprint.c:338: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 [1025]; data/vtprint-2.0.2/vtprint.c:339: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 on [1025]; data/vtprint-2.0.2/vtprint.c:340: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 off [1025]; data/vtprint-2.0.2/vtprint.c:345: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). libfile = fopen (libtermname, "r"); data/vtprint-2.0.2/vtprint.c:533:19: [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). outfile = fopen (devname, "w"); data/vtprint-2.0.2/vtprint.c:572: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. memcpy ((char *) &newstate, (char *) &oldstate, sizeof (termstate)); data/vtprint-2.0.2/vtprint.c:614:23: [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). else infile = fopen (argv[optind], "r"); data/vtprint-2.0.2/vtprint.c:379: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). if (on [strlen (on)-1] == '\n') on [strlen (on) - 1] = '\0'; data/vtprint-2.0.2/vtprint.c:379:45: [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 (on [strlen (on)-1] == '\n') on [strlen (on) - 1] = '\0'; data/vtprint-2.0.2/vtprint.c:380: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). if (off [strlen (off)-1] == '\n') off [strlen (off) -1 ] = '\0'; data/vtprint-2.0.2/vtprint.c:380:48: [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 (off [strlen (off)-1] == '\n') off [strlen (off) -1 ] = '\0'; data/vtprint-2.0.2/vtprint.c:436: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). env = (char *) malloc (strlen (tmp) + 1); data/vtprint-2.0.2/vtprint.c:628:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = fgetc (infile)) != EOF) ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 1475 in approximately 0.10 seconds (14775 lines/second) Physical Source Lines of Code (SLOC) = 661 Hits@level = [0] 50 [1] 6 [2] 7 [3] 5 [4] 1 [5] 0 Hits@level+ = [0+] 69 [1+] 19 [2+] 13 [3+] 6 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 104.387 [1+] 28.7443 [2+] 19.6672 [3+] 9.07716 [4+] 1.51286 [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.