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/vtgrab-0.1.8/rvc.c Examining data/vtgrab-0.1.8/rvcd.c Examining data/vtgrab-0.1.8/xfree86.c Examining data/vtgrab-0.1.8/nrvc.c Examining data/vtgrab-0.1.8/simple_panel.c Examining data/vtgrab-0.1.8/rvc.h Examining data/vtgrab-0.1.8/xfree86.h Examining data/vtgrab-0.1.8/simple_panel.h FINAL RESULTS: data/vtgrab-0.1.8/nrvc.c:531:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (param, "%s:%d", remote_host, port - 5900); data/vtgrab-0.1.8/nrvc.c:544: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 ("vncviewer", "vncviewer", param, NULL); data/vtgrab-0.1.8/rvc.c:96:12: [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. needed = vsnprintf (buf, allocated, reason, ap); data/vtgrab-0.1.8/rvcd.c:80:12: [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. needed = vsnprintf (buf, allocated, reason, ap); data/vtgrab-0.1.8/xfree86.c:131: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 ("xauth", "xauth", "nmerge", "-", NULL); data/vtgrab-0.1.8/xfree86.c:155: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 ("xauth", "xauth", "-f", cons->authority_file, data/vtgrab-0.1.8/xfree86.c:213: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 ("x0rfbserver", "x0rfbserver", "--stealth", NULL); data/vtgrab-0.1.8/xfree86.c:284:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (cmdline, "/proc/%s/cmdline", dent->d_name); data/vtgrab-0.1.8/xfree86.c:357:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (authority_file, "%s/.Xauthority", pw->pw_dir); data/vtgrab-0.1.8/nrvc.c:1010:11: [3] (buffer) getopt_long: 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. int c = getopt_long (argc, argv, "ce:", data/vtgrab-0.1.8/xfree86.c:93: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. oldpath = getenv ("PATH"); data/vtgrab-0.1.8/nrvc.c:423: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 (&content_length, &header[1], 2); data/vtgrab-0.1.8/nrvc.c:532:9: [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). null = open ("/dev/null", O_RDWR); data/vtgrab-0.1.8/nrvc.c:560: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 status_bar[100]; data/vtgrab-0.1.8/nrvc.c:569: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 (&port, &switchmsg[1], 2); data/vtgrab-0.1.8/nrvc.c:573:3: [2] (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). Risk is low because the source is a constant string. strcpy (status_bar, "Press Control-A for menu"); data/vtgrab-0.1.8/nrvc.c:575:3: [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 (status_bar, "tty%d (mode %d)", (int) switchmsg[0], data/vtgrab-0.1.8/nrvc.c:785: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 protocol_version[13]; data/vtgrab-0.1.8/nrvc.c:947: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 (&sin.sin_addr.s_addr, *h->h_addr_list, h->h_length); data/vtgrab-0.1.8/nrvc.c:1040:12: [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 ((fd = open (argv[optind], O_RDWR)) == -1) data/vtgrab-0.1.8/rvc.c:151: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. static unsigned char scratch[256]; data/vtgrab-0.1.8/rvc.c:158: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. unsigned char keymsg[2]; data/vtgrab-0.1.8/rvc.c:234: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 protocol_version[13]; data/vtgrab-0.1.8/rvc.c:241: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 fgcons[100]; data/vtgrab-0.1.8/rvc.c:243: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). int c = open ("/dev/console", O_RDONLY | O_NOCTTY); data/vtgrab-0.1.8/rvc.c:253:2: [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 (fgcons, "/dev/vcsa%d", vtstat.v_active); data/vtgrab-0.1.8/rvc.c:254: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). vcsa = fopen (fgcons, "r+"); data/vtgrab-0.1.8/rvc.c:392: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 (&sin.sin_addr.s_addr, *h->h_addr_list, h->h_length); data/vtgrab-0.1.8/rvc.c:432:12: [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 ((fd = open (argv[1], O_RDWR)) == -1) data/vtgrab-0.1.8/rvcd.c:138: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. unsigned char header[6]; data/vtgrab-0.1.8/rvcd.c:188: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 (header + 2, &content_length, 2); data/vtgrab-0.1.8/rvcd.c:197: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 (header + 2, &content_length, 2); data/vtgrab-0.1.8/rvcd.c:233: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. unsigned char header[10]; data/vtgrab-0.1.8/rvcd.c:288: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 (contents + 4, last + 4 + tryscrl * rowsize, data/vtgrab-0.1.8/rvcd.c:350: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 (header + 2, &content_length, 2); data/vtgrab-0.1.8/rvcd.c:367: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. static unsigned char scratch[256]; data/vtgrab-0.1.8/rvcd.c:374: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 tty[16]; data/vtgrab-0.1.8/rvcd.c:376:2: [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 (tty, "/dev/tty%d", vtstat.v_active); data/vtgrab-0.1.8/rvcd.c:377: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 (tty, O_RDONLY | O_NOCTTY); data/vtgrab-0.1.8/rvcd.c:392:11: [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 (tty, O_RDWR | O_NOCTTY); data/vtgrab-0.1.8/rvcd.c:394: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 (tty, O_RDONLY | O_NOCTTY); data/vtgrab-0.1.8/rvcd.c:396:9: [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 (tty, O_WRONLY | O_NOCTTY); data/vtgrab-0.1.8/rvcd.c:491: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 (switchmsg + 2, &port, 2); data/vtgrab-0.1.8/rvcd.c:505: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 fgcons[100]; data/vtgrab-0.1.8/rvcd.c:591:3: [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 (fgcons, "/dev/tty%d", vtstat.v_active); data/vtgrab-0.1.8/rvcd.c:592: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). c = open (fgcons, O_RDONLY | O_NOCTTY); data/vtgrab-0.1.8/rvcd.c:602:3: [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 (fgcons, "/dev/vcsa%d", vtstat.v_active); data/vtgrab-0.1.8/rvcd.c:609: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). c = open (fgcons, O_RDONLY | O_NOCTTY); data/vtgrab-0.1.8/rvcd.c:619: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 (last, contents, size); data/vtgrab-0.1.8/rvcd.c:623: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 (last, contents, size); data/vtgrab-0.1.8/rvcd.c:661: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 protocol_version[13]; data/vtgrab-0.1.8/rvcd.c:795:12: [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 ((fd = open (argv[1], O_RDWR | O_NOCTTY)) == -1) { data/vtgrab-0.1.8/xfree86.c:88: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 display[20]; data/vtgrab-0.1.8/xfree86.c:99: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 (path, x11, x11len); data/vtgrab-0.1.8/xfree86.c:100: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 (path + x11len, oldpath, pathlen); data/vtgrab-0.1.8/xfree86.c:102:2: [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 (display, ":%lu", cons->display); data/vtgrab-0.1.8/xfree86.c:103:9: [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). null = open ("/dev/null", O_RDWR); data/vtgrab-0.1.8/xfree86.c:179: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 display[20]; data/vtgrab-0.1.8/xfree86.c:187:2: [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 (display, ":%lu", cons->display); data/vtgrab-0.1.8/xfree86.c:188:9: [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). null = open ("/dev/null", O_RDWR); data/vtgrab-0.1.8/xfree86.c:268: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 cmdline[PATH_MAX]; data/vtgrab-0.1.8/xfree86.c:269: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 program[PATH_MAX]; data/vtgrab-0.1.8/xfree86.c:270: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 arg[PATH_MAX]; data/vtgrab-0.1.8/xfree86.c:285:14: [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). fcmdline = fopen (cmdline, "r"); data/vtgrab-0.1.8/nrvc.c:94:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t got = read (fd, buf, len); data/vtgrab-0.1.8/nrvc.c:528: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). param = malloc (strlen (remote_host) + 20); data/vtgrab-0.1.8/nrvc.c:577: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 (status_bar); data/vtgrab-0.1.8/rvc.c:140:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t got = read (fd, buf, len); data/vtgrab-0.1.8/rvc.c:160:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (STDIN_FILENO, &keymsg[1], 1) < 1) data/vtgrab-0.1.8/rvcd.c:124:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t got = read (fd, buf, len); data/vtgrab-0.1.8/rvcd.c:450:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (fd, &keymsg, 1) < 1) data/vtgrab-0.1.8/rvcd.c:459:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (fd, &switchmsg, 1) < 1) data/vtgrab-0.1.8/rvcd.c:614:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size = read (c, contents, MAX_CONTENTS); data/vtgrab-0.1.8/rvcd.c:649:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read (fd, contents, MAX_CONTENTS) > 0) data/vtgrab-0.1.8/xfree86.c:34:12: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int ch = fgetc (f); data/vtgrab-0.1.8/xfree86.c:94: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). pathlen = strlen (oldpath); data/vtgrab-0.1.8/xfree86.c:95: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). x11len = strlen (x11); data/vtgrab-0.1.8/xfree86.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). if (strlen (dent->d_name) + sizeof ("/proc/cmdline") >= data/vtgrab-0.1.8/xfree86.c:351: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 (pw->pw_dir); ANALYSIS SUMMARY: Hits = 79 Lines analyzed = 3089 in approximately 0.10 seconds (30712 lines/second) Physical Source Lines of Code (SLOC) = 2524 Hits@level = [0] 23 [1] 15 [2] 53 [3] 2 [4] 9 [5] 0 Hits@level+ = [0+] 102 [1+] 79 [2+] 64 [3+] 11 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 40.412 [1+] 31.2995 [2+] 25.3566 [3+] 4.35816 [4+] 3.56577 [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.