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/kerneltop-0.91/vidsupport.h Examining data/kerneltop-0.91/kerneltop.c FINAL RESULTS: data/kerneltop-0.91/kerneltop.c:106:3: [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 x; \ data/kerneltop-0.91/kerneltop.c:223:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cmdline, "zcat %s", name); data/kerneltop-0.91/kerneltop.c:224:9: [4] (shell) popen: 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. res = popen (cmdline, mode); data/kerneltop-0.91/kerneltop.c:288:8: [4] (shell) popen: 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. pin = popen ("uname -a", "r"); data/kerneltop-0.91/kerneltop.c:298:8: [4] (shell) popen: 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. pin = popen ("uname -r", "r"); data/kerneltop-0.91/kerneltop.c:599: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 (fn_name, defaultmap); data/kerneltop-0.91/kerneltop.c:601:2: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (fn_name, uname_release); data/kerneltop-0.91/kerneltop.c:609:2: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (fn_name, uname_release); data/kerneltop-0.91/kerneltop.c:623:7: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. if (sscanf (mapline, "%lx %s %s", &fn_adr, mode, fn_name) != 3) { data/kerneltop-0.91/kerneltop.c:648:7: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. if (sscanf (mapline, "%lx %s %s", &fn_adr, mode, fn_name) != 3) { data/kerneltop-0.91/kerneltop.c:689: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 (textsym->textname, begin_text); data/kerneltop-0.91/kerneltop.c:695:7: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. if (sscanf (mapline, "%lx %s %s", &fn_adr, mode, fn_name) != 3) { data/kerneltop-0.91/kerneltop.c:706:3: [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 (textsym->textname, fn_name); data/kerneltop-0.91/kerneltop.c:710: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 (textsym->textname, end_text); data/kerneltop-0.91/kerneltop.c:335: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. usr = getenv ("LOGNAME"); data/kerneltop-0.91/kerneltop.c:337: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. usr = getenv ("USER"); data/kerneltop-0.91/kerneltop.c:820:16: [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. while ((opt = getopt (argc, argv, optstring)) != -1) { data/kerneltop-0.91/kerneltop.c:114: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 textname[1]; // this field size is *dynamic* data/kerneltop-0.91/kerneltop.c:137:1: [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 uname_all [OUTPUT_SIZE], uname_release [OUTPUT_SIZE]; data/kerneltop-0.91/kerneltop.c:230: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). return fopen (name, mode); data/kerneltop-0.91/kerneltop.c:241: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 line[BUFSIZ]; /* BUFSIZ from <stdio.h>; arbitrary */ data/kerneltop-0.91/kerneltop.c:320: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 reply [OUTPUT_SIZE]; data/kerneltop-0.91/kerneltop.c:419: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(&termio_new, &termio_backup, sizeof(struct termios)); data/kerneltop-0.91/kerneltop.c:544:17: [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 ( ((proFd = open (proFile, O_RDONLY)) < 0) data/kerneltop-0.91/kerneltop.c:578: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 mapline [S_LEN]; data/kerneltop-0.91/kerneltop.c:581: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 fn_name [S_LEN]; data/kerneltop-0.91/kerneltop.c:582: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 [8]; data/kerneltop-0.91/kerneltop.c:608:2: [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 (fn_name, "/lib/modules/"); data/kerneltop-0.91/kerneltop.c:610:2: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat (fn_name, "/System.map"); data/kerneltop-0.91/kerneltop.c:218: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). int len = strlen (name); data/kerneltop-0.91/kerneltop.c:249:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read (STDIN_FILENO, &line[i], 1); data/kerneltop-0.91/kerneltop.c:307: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). if (uname_release [strlen (uname_release) - 1] == '\n') data/kerneltop-0.91/kerneltop.c:308: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). uname_release [strlen (uname_release) - 1] = '\0'; data/kerneltop-0.91/kerneltop.c:381:9: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void) getchar(); data/kerneltop-0.91/kerneltop.c:434:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). actual = read (keyboard_fd, &one_key, 1); data/kerneltop-0.91/kerneltop.c:559:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (proFd, *buf, len) != len) { data/kerneltop-0.91/kerneltop.c:600:2: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat (fn_name, "-"); data/kerneltop-0.91/kerneltop.c:668: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). fn_len = strlen (fn_name); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 1068 in approximately 0.09 seconds (12360 lines/second) Physical Source Lines of Code (SLOC) = 680 Hits@level = [0] 58 [1] 9 [2] 12 [3] 3 [4] 14 [5] 0 Hits@level+ = [0+] 96 [1+] 38 [2+] 29 [3+] 17 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 141.176 [1+] 55.8824 [2+] 42.6471 [3+] 25 [4+] 20.5882 [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.