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/itop-0.1/src/itop.c Examining data/itop-0.1/src/config.h FINAL RESULTS: data/itop-0.1/src/itop.c:139:2: [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("top"); data/itop-0.1/src/itop.c:156:2: [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(CLEAR); data/itop-0.1/src/itop.c:43: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 name[MAX_NAME_LEN+1]; data/itop-0.1/src/itop.c:47: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 buf[256]; data/itop-0.1/src/itop.c:51:12: [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((proc=fopen("/proc/interrupts","rt"))==NULL) { data/itop-0.1/src/itop.c:66:12: [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). cur_no=atoi(tmpptr); data/itop-0.1/src/itop.c:71:11: [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). count=atoi(tmpptr); data/itop-0.1/src/itop.c:118:12: [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). loop=atoi(argv[++count]); data/itop-0.1/src/itop.c:61:9: [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). buf[strlen(buf)-1]=0; data/itop-0.1/src/itop.c:74:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(interrupts[cur_no].name,buf+33,MAX_NAME_LEN+1); data/itop-0.1/src/itop.c:90:10: [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(interrupts[count].name)>0) || (interrupts[count].count>0)) data/itop-0.1/src/itop.c:132:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((loop<0) && (read(fileno(stdin),&key,1)==1)) { ANALYSIS SUMMARY: Hits = 12 Lines analyzed = 172 in approximately 0.02 seconds (7933 lines/second) Physical Source Lines of Code (SLOC) = 135 Hits@level = [0] 7 [1] 4 [2] 6 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 19 [1+] 12 [2+] 8 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 140.741 [1+] 88.8889 [2+] 59.2593 [3+] 14.8148 [4+] 14.8148 [5+] 0 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.