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/loadwatch-1.0+1.1alpha1/loadwatch.c Examining data/loadwatch-1.0+1.1alpha1/lw-ctl.c FINAL RESULTS: data/loadwatch-1.0+1.1alpha1/loadwatch.c:167:17: [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. if (execvp(*argv, argv) < 0) data/loadwatch-1.0+1.1alpha1/loadwatch.c:209:9: [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(addr.sun_path, sockname); data/loadwatch-1.0+1.1alpha1/loadwatch.c:271:13: [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(sockname, optarg); data/loadwatch-1.0+1.1alpha1/loadwatch.c:506:12: [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. file = popen("uptime", "r"); data/loadwatch-1.0+1.1alpha1/lw-ctl.c:23:5: [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(addr.sun_path, sockname); data/loadwatch-1.0+1.1alpha1/loadwatch.c:256:17: [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 ((c = getopt(argc, argv, "d:l:h:p:u:n:")) != -1) data/loadwatch-1.0+1.1alpha1/loadwatch.c:31: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 sockname[UNIX_PATH_MAX]; data/loadwatch-1.0+1.1alpha1/loadwatch.c:261:22: [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). copies = atoi(optarg); data/loadwatch-1.0+1.1alpha1/loadwatch.c:275:21: [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). delay = atoi(optarg); data/loadwatch-1.0+1.1alpha1/loadwatch.c:287: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). attach = getpgid(atoi(optarg)); data/loadwatch-1.0+1.1alpha1/loadwatch.c:451: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 line[81]; data/loadwatch-1.0+1.1alpha1/loadwatch.c:453: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). file = fopen("/proc/loadavg", "r"); data/loadwatch-1.0+1.1alpha1/loadwatch.c:504: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 line[81], *p; data/loadwatch-1.0+1.1alpha1/loadwatch.c:97:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((br = read(sock, cmd + tbr, size - tbr)) < 0) data/loadwatch-1.0+1.1alpha1/loadwatch.c:265:17: [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) >= UNIX_PATH_MAX) data/loadwatch-1.0+1.1alpha1/lw-ctl.c:31:13: [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). total = strlen(cmd); ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 589 in approximately 0.03 seconds (17164 lines/second) Physical Source Lines of Code (SLOC) = 504 Hits@level = [0] 29 [1] 3 [2] 7 [3] 1 [4] 5 [5] 0 Hits@level+ = [0+] 45 [1+] 16 [2+] 13 [3+] 6 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 89.2857 [1+] 31.746 [2+] 25.7937 [3+] 11.9048 [4+] 9.92063 [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.