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/devtodo-0.1.20/src/support.h Examining data/devtodo-0.1.20/src/todorl.h Examining data/devtodo-0.1.20/src/TodoDB.h Examining data/devtodo-0.1.20/src/Loaders.h Examining data/devtodo-0.1.20/src/main.cc Examining data/devtodo-0.1.20/src/todoterm.h Examining data/devtodo-0.1.20/src/Todo.cc Examining data/devtodo-0.1.20/src/Todo.h Examining data/devtodo-0.1.20/src/todoterm.cc Examining data/devtodo-0.1.20/src/Loaders.cc Examining data/devtodo-0.1.20/src/TodoDB.cc Examining data/devtodo-0.1.20/src/support.cc Examining data/devtodo-0.1.20/acconfig.h Examining data/devtodo-0.1.20/util/Regex.cc Examining data/devtodo-0.1.20/util/CommandArgs.cc Examining data/devtodo-0.1.20/util/Regex.h Examining data/devtodo-0.1.20/util/Lexer.h Examining data/devtodo-0.1.20/util/CommandArgs.h Examining data/devtodo-0.1.20/util/Lexer.cc Examining data/devtodo-0.1.20/util/Strings.cc Examining data/devtodo-0.1.20/util/XML.cc Examining data/devtodo-0.1.20/util/Terminal.h Examining data/devtodo-0.1.20/util/XML.h Examining data/devtodo-0.1.20/util/Strings.h Examining data/devtodo-0.1.20/util/Terminal.cc FINAL RESULTS: data/devtodo-0.1.20/src/TodoDB.cc:371:4: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(newname.c_str(), 0600); data/devtodo-0.1.20/src/TodoDB.cc:374:4: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(newname.c_str(), 0400); data/devtodo-0.1.20/src/TodoDB.cc:379:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(newname.c_str(), 0600); data/devtodo-0.1.20/src/TodoDB.cc:382:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(newname.c_str(), 0400); data/devtodo-0.1.20/src/TodoDB.cc:402:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(file.c_str(), _stat.st_mode); data/devtodo-0.1.20/src/TodoDB.cc:403:7: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown(file.c_str(), _stat.st_uid, _stat.st_gid); data/devtodo-0.1.20/src/support.cc:347:5: [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(i.parameter()); data/devtodo-0.1.20/util/Strings.cc:59:14: [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(command.c_str(), "r"); data/devtodo-0.1.20/src/support.cc:39:6: [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. if (getenv("HOME")) data/devtodo-0.1.20/src/support.cc:40:27: [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. globaldatabase = string(getenv("HOME")) + "/.todo_global"; data/devtodo-0.1.20/src/support.cc:793:6: [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. if (getenv("TODORC")) { data/devtodo-0.1.20/src/support.cc:794:16: [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. ifstream test(getenv("TODORC")); data/devtodo-0.1.20/src/support.cc:797:64: [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. cerr << "warning: TODORC envar points to invalid file '" << getenv("TODORC") << "'" << endl; data/devtodo-0.1.20/src/support.cc:799:21: [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. rcfile.push_back(getenv("TODORC")); data/devtodo-0.1.20/src/support.cc:808:6: [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. if (getenv("HOME")) { data/devtodo-0.1.20/src/support.cc:809:24: [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. ifstream test((string(getenv("HOME")) + "/.todorc").c_str()); data/devtodo-0.1.20/src/support.cc:812:29: [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. rcfile.push_back((string(getenv("HOME")) + "/.todorc").c_str()); data/devtodo-0.1.20/src/support.cc:899:10: [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. if (!getenv(var.c_str())) { data/devtodo-0.1.20/src/support.cc:903:13: [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. out += getenv(var.c_str()); data/devtodo-0.1.20/src/todoterm.cc:19:25: [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. char const *termtype = getenv("TERM"); data/devtodo-0.1.20/src/todoterm.cc:25:29: [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. int result = tgetent(info, getenv("TERM")); data/devtodo-0.1.20/src/Loaders.cc:259: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 buffer[size + 1]; data/devtodo-0.1.20/src/Loaders.cc:297: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 buffer[5]; data/devtodo-0.1.20/src/TodoDB.cc:1409: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 const *argv[v.size() + 1]; data/devtodo-0.1.20/src/TodoDB.cc:1464:2: [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 cwd[BUFSIZ]; data/devtodo-0.1.20/src/main.cc:7: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 const *av[args.size() + argc]; data/devtodo-0.1.20/src/support.cc:683: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 buffer[64]; data/devtodo-0.1.20/src/support.cc:820:2: [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 inputline[1024], *line = inputline; data/devtodo-0.1.20/src/todoterm.cc:12:8: [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. static char info[2048]; data/devtodo-0.1.20/util/Regex.cc:53:2: [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/devtodo-0.1.20/util/Strings.cc:60: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 buffer[1024]; data/devtodo-0.1.20/util/XML.cc:114: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 str[token.size()]; data/devtodo-0.1.20/src/Loaders.cc:154:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(str, s.st_size); data/devtodo-0.1.20/src/Loaders.cc:252:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read((char *)&n, sizeof(n)); data/devtodo-0.1.20/src/Loaders.cc:260:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(buffer, size); data/devtodo-0.1.20/src/Loaders.cc:299:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(buffer, 4); data/devtodo-0.1.20/src/support.cc:710: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). len = strlen(text); data/devtodo-0.1.20/util/XML.cc:115:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(str, token.value().c_str() + 1, token.size() - 2); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 4970 in approximately 0.17 seconds (28751 lines/second) Physical Source Lines of Code (SLOC) = 3946 Hits@level = [0] 0 [1] 6 [2] 11 [3] 13 [4] 2 [5] 6 Hits@level+ = [0+] 38 [1+] 38 [2+] 32 [3+] 21 [4+] 8 [5+] 6 Hits/KSLOC@level+ = [0+] 9.63001 [1+] 9.63001 [2+] 8.10948 [3+] 5.32184 [4+] 2.02737 [5+] 1.52053 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.