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/ethstatus-0.4.9/ethstatus.c Examining data/ethstatus-0.4.9/ethstatus.h FINAL RESULTS: data/ethstatus-0.4.9/ethstatus.c:65:4: [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(ifr.ifr_name, interface); data/ethstatus-0.4.9/ethstatus.c:94:4: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(location, MAIL_PATH "%s", stats.user_box); data/ethstatus-0.4.9/ethstatus.c:135:10: [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. (void)vsnprintf(final, 80, strg, trans); data/ethstatus-0.4.9/ethstatus.c:159:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(red_tmp, "Error! Unable to open %s\n" data/ethstatus-0.4.9/ethstatus.c:172:5: [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. sscanf(tmp, "%s %s %s %s %s %s %s %s %s %s %s", data/ethstatus-0.4.9/ethstatus.c:282:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temp, "%s", in); data/ethstatus-0.4.9/ethstatus.c:315:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(real, "%s", in); data/ethstatus-0.4.9/ethstatus.c:552:10: [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. (void)vsnprintf(final, strlen(errmsg), errmsg, trans); data/ethstatus-0.4.9/ethstatus.c:556:4: [4] (shell) system: 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. system("clear"); data/ethstatus-0.4.9/ethstatus.c:845:4: [4] (shell) system: 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. system("clear"); data/ethstatus-0.4.9/ethstatus.c:638:19: [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 ((option = getopt (argc, argv, "hi:s:S:v:")) != -1) data/ethstatus-0.4.9/ethstatus.c:92: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 location[128], buf[128]; data/ethstatus-0.4.9/ethstatus.c:101: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). if((email_box = fopen(location, "r"))) data/ethstatus-0.4.9/ethstatus.c:153: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 check[256], red_tmp[256], *tmp; data/ethstatus-0.4.9/ethstatus.c:155: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 b_rx[32], b_tx[32], e_rx[32], e_tx[32], p_rx[32], p_tx[32]; data/ethstatus-0.4.9/ethstatus.c:157:20: [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). if((routefile = fopen(PATH_PROC_NET_DEV, "r")) == NULL) data/ethstatus-0.4.9/ethstatus.c:179:34: [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). stats.tx_errors[0] = (double)atoi(e_tx); data/ethstatus-0.4.9/ethstatus.c:182:34: [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). stats.rx_errors[0] = (double)atoi(e_rx); data/ethstatus-0.4.9/ethstatus.c:279: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 real[256], temp[256], *rt; data/ethstatus-0.4.9/ethstatus.c:313: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 real[256], get[256], *rt; data/ethstatus-0.4.9/ethstatus.c:859: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(str, "%.2f G", (bytes/ (double) (1024*1024*1024))); data/ethstatus-0.4.9/ethstatus.c:861: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(str, "%.2f M", (bytes/ (double) (1024*1024))); data/ethstatus-0.4.9/ethstatus.c:863: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(str, "%.2f K", (bytes/ (double) (1024))); data/ethstatus-0.4.9/ethstatus.c:864: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. else sprintf(str, "%.2f ", bytes); data/ethstatus-0.4.9/ethstatus.h:75: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 user_box[32]; data/ethstatus-0.4.9/ethstatus.h:101: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 home[128]; data/ethstatus-0.4.9/ethstatus.h:103: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 data_type[6] = "bytes"; data/ethstatus-0.4.9/ethstatus.h:104: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 mth[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", data/ethstatus-0.4.9/ethstatus.h:112: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 autoscalebytes[15]; data/ethstatus-0.4.9/ethstatus.c:137: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). where = (int)(40 - (strlen(final) / 2)); data/ethstatus-0.4.9/ethstatus.c:281:16: [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). bzero(temp, strlen(in)); data/ethstatus-0.4.9/ethstatus.c:284:16: [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). bzero(real, strlen(real)); data/ethstatus-0.4.9/ethstatus.c:285: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). for(a = 0; a < strlen(temp)-1; a++){ data/ethstatus-0.4.9/ethstatus.c:301:16: [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). rt = malloc(strlen(real)); data/ethstatus-0.4.9/ethstatus.c:316: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). for(a = 0; a <= strlen(real)-1; a++) data/ethstatus-0.4.9/ethstatus.c:330:16: [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). rt = malloc(strlen(get)); data/ethstatus-0.4.9/ethstatus.c:550: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). final = malloc(strlen(errmsg)); data/ethstatus-0.4.9/ethstatus.c:552:27: [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). (void)vsnprintf(final, strlen(errmsg), errmsg, trans); data/ethstatus-0.4.9/ethstatus.c:648: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). if(strlen(optarg) > 20) data/ethstatus-0.4.9/ethstatus.c:825:3: [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(500000L); data/ethstatus-0.4.9/ethstatus.c:828:2: [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(900000L); ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 988 in approximately 0.06 seconds (15947 lines/second) Physical Source Lines of Code (SLOC) = 745 Hits@level = [0] 9 [1] 12 [2] 18 [3] 1 [4] 10 [5] 0 Hits@level+ = [0+] 50 [1+] 41 [2+] 29 [3+] 11 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 67.1141 [1+] 55.0336 [2+] 38.9262 [3+] 14.7651 [4+] 13.4228 [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.