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/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c FINAL RESULTS: data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:414:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ErrorMessage, data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:809:13: [4] (shell) execvp: 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. execvp(argv[ArgOffset+3],argv+ArgOffset+3); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:36: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. typedef char String[STRING_LENGTH]; data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:165:26: [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). PID = (pid_t)atoi(ProcessDir->d_name); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:166:13: [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(ProcFileName,"/proc/%d/status",PID); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:167:29: [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 ((ProcFile = fopen(ProcFileName,"r")) != NULL) { data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:212:5: [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(ProcFileName,"/proc/%d/stat",PID); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:213:21: [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 ((ProcFile = fopen(ProcFileName,"r")) != NULL) { data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:260:26: [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). PID = (pid_t)atoi(ProcessDir->d_name); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:261:13: [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(ProcFileName,"/proc/%d/psinfo",(int)PID); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:262:29: [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 ((ProcFile = fopen(ProcFileName,"r")) != NULL) { data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:292:5: [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(ProcFileName,"/proc/%d/status",(int)PID); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:293:21: [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 ((ProcFile = fopen(ProcFileName,"r")) != NULL) { data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:698:26: [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). QuietnessLevel = atoi(&argv[ArgOffset][2]); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:708:30: [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). DelayBetweenChecks = atoi(&argv[ArgOffset][2]); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:714: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). DelayBetweenChecks = atoi(&argv[ArgOffset][2]); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:727:24: [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). CPUTimeLimit = atoi(argv[ArgOffset+1]); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:728:23: [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). WCTimeLimit = atoi(argv[ArgOffset+2]); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:730:27: [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). MemoryLimit = atoi(argv[ArgOffset+3]); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:469:9: [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(500000); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:472:9: [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(100000); data/matita-0.99.3/components/binaries/matitaprover/TreeLimitedRun.c:486:9: [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(100000); ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 854 in approximately 0.06 seconds (13867 lines/second) Physical Source Lines of Code (SLOC) = 605 Hits@level = [0] 22 [1] 3 [2] 17 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 44 [1+] 22 [2+] 19 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 72.7273 [1+] 36.3636 [2+] 31.405 [3+] 3.30579 [4+] 3.30579 [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.