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/incron-0.5.12/appargs.cpp Examining data/incron-0.5.12/appargs.h Examining data/incron-0.5.12/appinst.cpp Examining data/incron-0.5.12/appinst.h Examining data/incron-0.5.12/executor.h Examining data/incron-0.5.12/ict-main.cpp Examining data/incron-0.5.12/incron.h Examining data/incron-0.5.12/incroncfg.cpp Examining data/incron-0.5.12/incroncfg.h Examining data/incron-0.5.12/incrontab.cpp Examining data/incron-0.5.12/incrontab.h Examining data/incron-0.5.12/inotify-cxx.cpp Examining data/incron-0.5.12/inotify-cxx.h Examining data/incron-0.5.12/strtok.cpp Examining data/incron-0.5.12/strtok.h Examining data/incron-0.5.12/usertable.cpp Examining data/incron-0.5.12/usertable.h Examining data/incron-0.5.12/icd-main.cpp FINAL RESULTS: data/incron-0.5.12/ict-main.cpp:108:7: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(out.c_str(), ppwd->pw_uid, -1) != 0) { data/incron-0.5.12/ict-main.cpp:334:11: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(tp.c_str(), S_IRUSR | S_IWUSR) != 0) { data/incron-0.5.12/executor.h:69:17: [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* pipe = popen(cmd, "r"); data/incron-0.5.12/icd-main.cpp:379:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(sysBase.c_str(), R_OK) != 0) { data/incron-0.5.12/icd-main.cpp:390:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(userBase.c_str(), R_OK) != 0) { data/incron-0.5.12/ict-main.cpp:283:13: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(INCRON_ALT_EDITOR, X_OK) == 0) data/incron-0.5.12/ict-main.cpp:300:7: [4] (shell) execlp: 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. execlp(e, e, s, (const char*) NULL); data/incron-0.5.12/incrontab.cpp:239:13: [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. if (sscanf(s, "%s", u) == 1) { data/incron-0.5.12/incrontab.cpp:254:9: [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. if (sscanf(s, "%s", u) == 1) { data/incron-0.5.12/usertable.cpp:474:11: [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. if (system(cmd.c_str()) != 0) // exec failed data/incron-0.5.12/usertable.cpp:600:3: [4] (shell) execlp: 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. execlp("/bin/bash","/bin/bash", "-c", cmd.c_str(), (char *)NULL); data/incron-0.5.12/ict-main.cpp:271:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. e = getenv("EDITOR"); data/incron-0.5.12/ict-main.cpp:273:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. e = getenv("VISUAL"); data/incron-0.5.12/appinst.cpp:58:12: [2] (misc) open: 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). int fd = open(m_path.c_str(), O_WRONLY | O_CREAT | O_EXCL, APPLOCK_PERM); data/incron-0.5.12/appinst.cpp:92:15: [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* f = fopen(m_path.c_str(), "r"); data/incron-0.5.12/appinst.cpp:145:13: [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* f = fopen(m_path.c_str(), "r"); data/incron-0.5.12/appinst.cpp:173:13: [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* f = fopen(m_path.c_str(), "r"); data/incron-0.5.12/executor.h:71: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 buffer[128]; data/incron-0.5.12/icd-main.cpp:82: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 g_cldPipeBuf[CHILD_PIPE_BUF_LEN]; data/incron-0.5.12/ict-main.cpp:151:13: [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* f = fopen(tp.c_str(), "r"); data/incron-0.5.12/ict-main.cpp:163: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 s[1024]; data/incron-0.5.12/ict-main.cpp:195: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 s[NAME_MAX]; data/incron-0.5.12/ict-main.cpp:196:3: [2] (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). Risk is low because the source is a constant string. strcpy(s, "/tmp/incron.table-XXXXXX"); data/incron-0.5.12/ict-main.cpp:206:12: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int fd = mkstemp(s); data/incron-0.5.12/ict-main.cpp:232:8: [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). in = fopen(tp.c_str(), "r"); data/incron-0.5.12/ict-main.cpp:235: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). in = fopen("/dev/null", "r"); data/incron-0.5.12/ict-main.cpp:249: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[1024]; data/incron-0.5.12/ict-main.cpp:389:12: [2] (misc) open: 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). int fd = open(tp.c_str(), O_WRONLY | O_APPEND); data/incron-0.5.12/incroncfg.cpp:51: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 s[1024]; data/incron-0.5.12/incroncfg.cpp:69:6: [2] (misc) open: 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). is.open(INCRON_CFG_DEFAULT); data/incron-0.5.12/incroncfg.cpp:149: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 key[1024], val[1024]; data/incron-0.5.12/incrontab.cpp:185:13: [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* f = fopen(rPath.c_str(), "r"); data/incron-0.5.12/incrontab.cpp:189: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 s[1000]; data/incron-0.5.12/incrontab.cpp:204:13: [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* f = fopen(rPath.c_str(), "w"); data/incron-0.5.12/incrontab.cpp:222: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 s[100], u[100]; data/incron-0.5.12/incrontab.cpp:228:13: [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* f = fopen(path.c_str(), "r"); data/incron-0.5.12/incrontab.cpp:234: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). f = fopen(path.c_str(), "r"); data/incron-0.5.12/inotify-cxx.cpp:589:13: [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* f = fopen(GetCapabilityPath(cap).c_str(), "r"); data/incron-0.5.12/inotify-cxx.cpp:606:13: [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* f = fopen(GetCapabilityPath(cap).c_str(), "w"); data/incron-0.5.12/inotify-cxx.h:877:12: [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. unsigned char m_buf[INOTIFY_BUFLEN]; ///< buffer for events data/incron-0.5.12/appargs.cpp:213:7: [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(pchStr) < 2) data/incron-0.5.12/appargs.cpp:244: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). size_t len = strlen(pchStr); data/incron-0.5.12/icd-main.cpp:109:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). do {} while (read(g_cldPipe[0], g_cldPipeBuf, CHILD_PIPE_BUF_LEN) > 0); data/incron-0.5.12/inotify-cxx.cpp:440:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(m_fd, m_buf, INOTIFY_BUFLEN); data/incron-0.5.12/usertable.cpp:87:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(m_pPoll[0].fd, &c, 1) > 0) {} ANALYSIS SUMMARY: Hits = 45 Lines analyzed = 5696 in approximately 0.15 seconds (38100 lines/second) Physical Source Lines of Code (SLOC) = 3172 Hits@level = [0] 111 [1] 5 [2] 27 [3] 2 [4] 9 [5] 2 Hits@level+ = [0+] 156 [1+] 45 [2+] 40 [3+] 13 [4+] 11 [5+] 2 Hits/KSLOC@level+ = [0+] 49.1803 [1+] 14.1866 [2+] 12.6103 [3+] 4.09836 [4+] 3.46784 [5+] 0.630517 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.