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/bwbar-1.2.3/bwbar.c FINAL RESULTS: data/bwbar-1.2.3/bwbar.c:295: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(text_file, directory); data/bwbar-1.2.3/bwbar.c:297: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(text_file, tmp_char); data/bwbar-1.2.3/bwbar.c:301: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(graphics_file, directory); data/bwbar-1.2.3/bwbar.c:303: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(graphics_file, tmp_char); data/bwbar-1.2.3/bwbar.c:311:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(t_tmp, "%s.tmp", text_file); data/bwbar-1.2.3/bwbar.c:312:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(g_tmp, "%s.tmp", graphics_file); data/bwbar-1.2.3/bwbar.c:228:18: [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. while ( (opt = getopt_long(argc, argv, "iof:p:t:x:y:b:kMGhd:", longopts, NULL)) != -1 ) { data/bwbar-1.2.3/bwbar.c:200: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 name[8]; data/bwbar-1.2.3/bwbar.c:246:18: [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). interval = atoi(optarg); data/bwbar-1.2.3/bwbar.c:249:15: [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). width = atoi(optarg); data/bwbar-1.2.3/bwbar.c:252:16: [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). height = atoi(optarg); data/bwbar-1.2.3/bwbar.c:255:16: [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). border = atoi(optarg); data/bwbar-1.2.3/bwbar.c:327:11: [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). pnd = fopen("/proc/net/dev", "r"); data/bwbar-1.2.3/bwbar.c:371: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). ubar = fopen(t_tmp, "w"); data/bwbar-1.2.3/bwbar.c:372:18: [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). pngmaker = fopen(g_tmp, "w"); data/bwbar-1.2.3/bwbar.c:39:10: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getc(f); data/bwbar-1.2.3/bwbar.c:294: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). text_file = malloc(strlen(text_file) + strlen(directory) + 5); data/bwbar-1.2.3/bwbar.c:294:41: [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). text_file = malloc(strlen(text_file) + strlen(directory) + 5); data/bwbar-1.2.3/bwbar.c:296: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(text_file, "/"); data/bwbar-1.2.3/bwbar.c:300:25: [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). graphics_file = malloc(strlen(graphics_file) + strlen(directory) + 5); data/bwbar-1.2.3/bwbar.c:300:49: [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). graphics_file = malloc(strlen(graphics_file) + strlen(directory) + 5); data/bwbar-1.2.3/bwbar.c:302: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(graphics_file, "/"); data/bwbar-1.2.3/bwbar.c:305: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). t_tmp = malloc(strlen(text_file) + 5); data/bwbar-1.2.3/bwbar.c:306: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). g_tmp = malloc(strlen(graphics_file) + 5); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 393 in approximately 0.04 seconds (9821 lines/second) Physical Source Lines of Code (SLOC) = 311 Hits@level = [0] 4 [1] 9 [2] 8 [3] 1 [4] 6 [5] 0 Hits@level+ = [0+] 28 [1+] 24 [2+] 15 [3+] 7 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 90.0322 [1+] 77.1704 [2+] 48.2315 [3+] 22.508 [4+] 19.2926 [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.