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/nullmailer-2.2/lib/ac/dirent.h Examining data/nullmailer-2.2/lib/ac/time.h Examining data/nullmailer-2.2/lib/ac/wait.h Examining data/nullmailer-2.2/lib/address-old.cc Examining data/nullmailer-2.2/lib/address.cc Examining data/nullmailer-2.2/lib/address.h Examining data/nullmailer-2.2/lib/argparse.cc Examining data/nullmailer-2.2/lib/argparse.h Examining data/nullmailer-2.2/lib/autoclose.h Examining data/nullmailer-2.2/lib/base64.cc Examining data/nullmailer-2.2/lib/base64.h Examining data/nullmailer-2.2/lib/canonicalize.cc Examining data/nullmailer-2.2/lib/canonicalize.h Examining data/nullmailer-2.2/lib/cli++/cli++.h Examining data/nullmailer-2.2/lib/cli++/clitest.cc Examining data/nullmailer-2.2/lib/cli++/main.cc Examining data/nullmailer-2.2/lib/cli++/messages.cc Examining data/nullmailer-2.2/lib/cli++/only_long.cc Examining data/nullmailer-2.2/lib/config_path.cc Examining data/nullmailer-2.2/lib/config_read.cc Examining data/nullmailer-2.2/lib/config_readint.cc Examining data/nullmailer-2.2/lib/config_readlist.cc Examining data/nullmailer-2.2/lib/config_syserr.cc Examining data/nullmailer-2.2/lib/configio.h Examining data/nullmailer-2.2/lib/connect.h Examining data/nullmailer-2.2/lib/defines.h Examining data/nullmailer-2.2/lib/errcodes.cc Examining data/nullmailer-2.2/lib/errcodes.h Examining data/nullmailer-2.2/lib/fdbuf/fdbuf.cc Examining data/nullmailer-2.2/lib/fdbuf/fdbuf.h Examining data/nullmailer-2.2/lib/fdbuf/fdbuf_copy.cc Examining data/nullmailer-2.2/lib/fdbuf/fdbuf_test.cc Examining data/nullmailer-2.2/lib/fdbuf/fdibuf.cc Examining data/nullmailer-2.2/lib/fdbuf/fdibuf.h Examining data/nullmailer-2.2/lib/fdbuf/fdibuf_mystring.cc Examining data/nullmailer-2.2/lib/fdbuf/fdibuf_netstring.cc Examining data/nullmailer-2.2/lib/fdbuf/fdobuf.cc Examining data/nullmailer-2.2/lib/fdbuf/fdobuf.h Examining data/nullmailer-2.2/lib/fdbuf/fdobuf_chownmod.cc Examining data/nullmailer-2.2/lib/fdbuf/fdobuf_seek.cc Examining data/nullmailer-2.2/lib/fdbuf/fdobuf_signed.cc Examining data/nullmailer-2.2/lib/fdbuf/fdobuf_unsigned.cc Examining data/nullmailer-2.2/lib/fdbuf/tlsibuf.cc Examining data/nullmailer-2.2/lib/fdbuf/tlsibuf.h Examining data/nullmailer-2.2/lib/fdbuf/tlsobuf.cc Examining data/nullmailer-2.2/lib/fdbuf/tlsobuf.h Examining data/nullmailer-2.2/lib/forkexec.cc Examining data/nullmailer-2.2/lib/forkexec.h Examining data/nullmailer-2.2/lib/hostname.h Examining data/nullmailer-2.2/lib/itoa.cc Examining data/nullmailer-2.2/lib/itoa.h Examining data/nullmailer-2.2/lib/list.h Examining data/nullmailer-2.2/lib/listtest.cc Examining data/nullmailer-2.2/lib/makefield.cc Examining data/nullmailer-2.2/lib/makefield.h Examining data/nullmailer-2.2/lib/mystring/append.cc Examining data/nullmailer-2.2/lib/mystring/assign.cc Examining data/nullmailer-2.2/lib/mystring/count.cc Examining data/nullmailer-2.2/lib/mystring/fdobuf.cc Examining data/nullmailer-2.2/lib/mystring/find_first_ch.cc Examining data/nullmailer-2.2/lib/mystring/find_first_of.cc Examining data/nullmailer-2.2/lib/mystring/find_last_ch.cc Examining data/nullmailer-2.2/lib/mystring/find_last_of.cc Examining data/nullmailer-2.2/lib/mystring/iter.cc Examining data/nullmailer-2.2/lib/mystring/iter.h Examining data/nullmailer-2.2/lib/mystring/join.cc Examining data/nullmailer-2.2/lib/mystring/join.h Examining data/nullmailer-2.2/lib/mystring/lower.cc Examining data/nullmailer-2.2/lib/mystring/lstrip.cc Examining data/nullmailer-2.2/lib/mystring/mystring.cc Examining data/nullmailer-2.2/lib/mystring/mystring.h Examining data/nullmailer-2.2/lib/mystring/operator_in.cc Examining data/nullmailer-2.2/lib/mystring/rep.cc Examining data/nullmailer-2.2/lib/mystring/rep.h Examining data/nullmailer-2.2/lib/mystring/rstrip.cc Examining data/nullmailer-2.2/lib/mystring/starts_with.cc Examining data/nullmailer-2.2/lib/mystring/strip.cc Examining data/nullmailer-2.2/lib/mystring/sub.cc Examining data/nullmailer-2.2/lib/mystring/subst.cc Examining data/nullmailer-2.2/lib/mystring/trace.h Examining data/nullmailer-2.2/lib/mystring/upper.cc Examining data/nullmailer-2.2/lib/netstring.cc Examining data/nullmailer-2.2/lib/netstring.h Examining data/nullmailer-2.2/lib/selfpipe.cc Examining data/nullmailer-2.2/lib/selfpipe.h Examining data/nullmailer-2.2/lib/setenv.cc Examining data/nullmailer-2.2/lib/setenv.h Examining data/nullmailer-2.2/lib/tcpconnect.cc Examining data/nullmailer-2.2/lib/hostname.cc Examining data/nullmailer-2.2/protocols/protocol.cc Examining data/nullmailer-2.2/protocols/protocol.h Examining data/nullmailer-2.2/protocols/qmqp.cc Examining data/nullmailer-2.2/protocols/smtp.cc Examining data/nullmailer-2.2/protocols/tls_gnutls.cc Examining data/nullmailer-2.2/protocols/tls_none.cc Examining data/nullmailer-2.2/src/address-main.cc Examining data/nullmailer-2.2/src/dsn.cc Examining data/nullmailer-2.2/src/inject.cc Examining data/nullmailer-2.2/src/mailq.cc Examining data/nullmailer-2.2/src/send.cc Examining data/nullmailer-2.2/src/sendmail.cc Examining data/nullmailer-2.2/src/smtpd.cc Examining data/nullmailer-2.2/src/queue.cc Examining data/nullmailer-2.2/test/address-test.cc Examining data/nullmailer-2.2/test/address-trace.cc Examining data/nullmailer-2.2/test/argparse-test.cc Examining data/nullmailer-2.2/test/clitest.cc FINAL RESULTS: data/nullmailer-2.2/lib/fdbuf/fdobuf.h:54:8: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. bool chown(uid_t, gid_t) const; data/nullmailer-2.2/lib/fdbuf/fdobuf.h:55:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. bool chmod(mode_t) const; data/nullmailer-2.2/lib/fdbuf/fdobuf_chownmod.cc:22:14: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. bool fdobuf::chown(uid_t uid, gid_t gid) const data/nullmailer-2.2/lib/fdbuf/fdobuf_chownmod.cc:29:14: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. bool fdobuf::chmod(mode_t mode) const data/nullmailer-2.2/lib/forkexec.cc:89:5: [4] (shell) execv: 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. execv(args[0], (char**)args); data/nullmailer-2.2/protocols/tls_gnutls.cc:112:33: [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 (tls_x509cafile == NULL && access(DEFAULT_CA_FILE, R_OK) == 0) data/nullmailer-2.2/src/sendmail.cc:107:3: [4] (shell) execv: 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. execv(args[0], (char**)args); data/nullmailer-2.2/lib/cli++/main.cc:26:6: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void srandom(unsigned int seed); data/nullmailer-2.2/lib/cli++/main.cc:360:3: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom(tv.tv_usec ^ tv.tv_sec); data/nullmailer-2.2/lib/config_path.cc:42: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. test_prefix = getenv("NULLMAILER_TEST_PREFIX"); data/nullmailer-2.2/lib/forkexec.cc:149: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. if ((env = getenv("NULLMAILER_QUEUE")) != NULL) data/nullmailer-2.2/protocols/smtp.cc:123:17: [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. mystring hh = getenv("HELOHOST"); data/nullmailer-2.2/src/inject.cc:258:19: [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. mystring user = getenv("NULLMAILER_USER"); data/nullmailer-2.2/src/inject.cc:259:20: [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(!user) user = getenv("MAILUSER"); data/nullmailer-2.2/src/inject.cc:260:20: [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(!user) user = getenv("USER"); data/nullmailer-2.2/src/inject.cc:261:20: [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(!user) user = getenv("LOGNAME"); data/nullmailer-2.2/src/inject.cc:268:19: [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. mystring host = getenv("NULLMAILER_HOST"); data/nullmailer-2.2/src/inject.cc:269:20: [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(!host) host = getenv("MAILHOST"); data/nullmailer-2.2/src/inject.cc:270:20: [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(!host) host = getenv("HOSTNAME"); data/nullmailer-2.2/src/inject.cc:274:19: [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. mystring name = getenv("NULLMAILER_NAME"); data/nullmailer-2.2/src/inject.cc:275:20: [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(!name) name = getenv("MAILNAME"); data/nullmailer-2.2/src/inject.cc:276:20: [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(!name) name = getenv("NAME"); data/nullmailer-2.2/src/inject.cc:288:20: [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. mystring suser = getenv("NULLMAILER_SUSER"); data/nullmailer-2.2/src/inject.cc:291:20: [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. mystring shost = getenv("NULLMAILER_SHOST"); data/nullmailer-2.2/src/inject.cc:492: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. for(const char* flagstr = getenv("NULLMAILER_FLAGS"); data/nullmailer-2.2/lib/address-old.cc:153: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 out[length*2 + 2 + 1]; data/nullmailer-2.2/lib/address-old.cc:175: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 out[length+1]; data/nullmailer-2.2/lib/address-old.cc:219: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 tmp[ptr-start+2]; data/nullmailer-2.2/lib/address-old.cc:221:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(tmp+1, start, ptr-start); data/nullmailer-2.2/lib/address.cc:322: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 out[length*2 + 2 + 1]; data/nullmailer-2.2/lib/address.cc:344: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 out[length+1]; data/nullmailer-2.2/lib/autoclose.h:46:15: [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). inline bool open() data/nullmailer-2.2/lib/base64.cc:31: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[4]; data/nullmailer-2.2/lib/base64.cc:44:41: [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. void base64_encode_chunk(const unsigned char bin[3], unsigned len, data/nullmailer-2.2/lib/base64.cc:45: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 encoded[4]) data/nullmailer-2.2/lib/base64.h:7:48: [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. extern void base64_encode_chunk(const unsigned char bin[3], unsigned len, data/nullmailer-2.2/lib/base64.h:8: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 encoded[4]); data/nullmailer-2.2/lib/cli++/main.cc:346:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(tmp, p, length); data/nullmailer-2.2/lib/fdbuf/fdbuf_copy.cc:29: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 buf[FDBUF_SIZE]; data/nullmailer-2.2/lib/fdbuf/fdbuf_test.cc:6: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[17]; buf[16] = 0; data/nullmailer-2.2/lib/fdbuf/fdibuf.cc:32:11: [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). : fdbuf(open(filename, O_RDONLY), true, bufsz) data/nullmailer-2.2/lib/fdbuf/fdibuf.cc:62:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, buf+bufstart, buflength); data/nullmailer-2.2/lib/fdbuf/fdibuf.cc:110:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, buf+bufstart, len); data/nullmailer-2.2/lib/fdbuf/fdibuf.cc:151:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ptr, buf+bufstart, len); data/nullmailer-2.2/lib/fdbuf/fdibuf_netstring.cc:36: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 tmp[size]; data/nullmailer-2.2/lib/fdbuf/fdobuf.cc:39:11: [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). : fdbuf(open(filename, O_WRONLY | f, mode), true, bufsz), data/nullmailer-2.2/lib/fdbuf/fdobuf.cc:180:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf+bufpos, ptr, amount); data/nullmailer-2.2/lib/fdbuf/fdobuf.cc:193:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf+bufpos, ptr, datalen); data/nullmailer-2.2/lib/fdbuf/fdobuf_signed.cc:30: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[MAXSTRLEN+1]; data/nullmailer-2.2/lib/fdbuf/fdobuf_unsigned.cc:26: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[MAXSTRLEN+1]; data/nullmailer-2.2/lib/forkexec.cc:60:21: [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). if (!pipes[i].open()) data/nullmailer-2.2/lib/forkexec.cc:64:23: [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). if ((fdnull = open("/dev/null", O_RDWR)) < 0) data/nullmailer-2.2/lib/itoa.cc:5:10: [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 buf[INTLENGTH]; data/nullmailer-2.2/lib/makefield.cc:31: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/nullmailer-2.2/lib/makefield.cc:46: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 tz[6]; data/nullmailer-2.2/lib/mystring/join.cc:55:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, item->str, l); data/nullmailer-2.2/lib/mystring/lower.cc:7: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[length+1]; data/nullmailer-2.2/lib/mystring/mystring.h:109:7: [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[2] = { ch, 0 }; data/nullmailer-2.2/lib/mystring/operator_in.cc:7: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]; // buffer this many characters at a time data/nullmailer-2.2/lib/mystring/rep.cc:100:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ptr->buf, str, length); data/nullmailer-2.2/lib/mystring/rep.cc:112:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ptr->buf, str1, length1); data/nullmailer-2.2/lib/mystring/rep.cc:113:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ptr->buf+length1, str2, length2); data/nullmailer-2.2/lib/mystring/rep.cc:133:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf+length, str, len); data/nullmailer-2.2/lib/mystring/rep.h:26: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[1]; data/nullmailer-2.2/lib/mystring/subst.cc:6: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[length+1]; data/nullmailer-2.2/lib/mystring/upper.cc:7: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[length+1]; data/nullmailer-2.2/lib/setenv.cc:35:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(str, var, varlen); data/nullmailer-2.2/lib/setenv.cc:37:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(str+varlen+1, val, vallen); data/nullmailer-2.2/lib/tcpconnect.cc:143:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&sa.sin_addr, he->h_addr, he->h_length); data/nullmailer-2.2/protocols/qmqp.cc:94: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[4096]; data/nullmailer-2.2/protocols/smtp.cc:76: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). code = atoi(tmp.c_str()); data/nullmailer-2.2/src/mailq.cc:51:19: [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). time_t time = atoi(name); data/nullmailer-2.2/src/mailq.cc:52: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 timebuf[100]; data/nullmailer-2.2/src/queue.cc:66:18: [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). autoclose fd = open(path, O_RDONLY); data/nullmailer-2.2/src/queue.cc:77:18: [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). autoclose fd = open(trigger_path.c_str(), O_WRONLY|O_NONBLOCK, 0666); data/nullmailer-2.2/src/queue.cc:128: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[100]; data/nullmailer-2.2/src/queue.cc:169:13: [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 out = open(tmpfile.c_str(), O_CREAT|O_WRONLY|O_TRUNC, 0600); data/nullmailer-2.2/src/queue.cc:169:18: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). int out = open(tmpfile.c_str(), O_CREAT|O_WRONLY|O_TRUNC, 0600); data/nullmailer-2.2/src/queue.cc:173:12: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). unlink(tmpfile.c_str()); data/nullmailer-2.2/src/queue.cc:176:11: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(link(tmpfile.c_str(), newfile.c_str())) data/nullmailer-2.2/src/queue.cc:180:13: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(unlink(tmpfile.c_str())) data/nullmailer-2.2/src/send.cc:283: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/nullmailer-2.2/src/send.cc:292:18: [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). autoclose fd = open(filename.c_str(), O_RDONLY); data/nullmailer-2.2/src/send.cc:351:18: [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). autoclose fd = open(failed.c_str(), O_RDONLY); data/nullmailer-2.2/src/send.cc:433:13: [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). trigger = open(trigger_path.c_str(), O_RDONLY|O_NONBLOCK); data/nullmailer-2.2/src/send.cc:435:14: [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). trigger2 = open(trigger_path.c_str(), O_WRONLY|O_NONBLOCK); data/nullmailer-2.2/src/send.cc:445: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 buf[1024]; data/nullmailer-2.2/lib/ac/dirent.h:4:25: [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). # define NAMLEN(dirent) strlen((dirent)->d_name) data/nullmailer-2.2/lib/cli++/main.cc:89:14: [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). width += strlen(o->name) + 2 + !cli_only_long; data/nullmailer-2.2/lib/cli++/main.cc:133:22: [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). << fill(maxwidth - strlen(o->name) - strlen(extra) - !cli_only_long data/nullmailer-2.2/lib/cli++/main.cc:133:40: [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). << fill(maxwidth - strlen(o->name) - strlen(extra) - !cli_only_long data/nullmailer-2.2/lib/cli++/main.cc:216: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). int end = strlen(argv[0]) - 1; data/nullmailer-2.2/lib/cli++/main.cc:291:20: [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(o->name); data/nullmailer-2.2/lib/fdbuf/fdbuf_copy.cc:30:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(!in.read(buf, FDBUF_SIZE) && in.last_count() == 0) data/nullmailer-2.2/lib/fdbuf/fdbuf_test.cc:8:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(buf, 16); fout.write(buf); fout.flush(); data/nullmailer-2.2/lib/fdbuf/fdbuf_test.cc:11:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(buf, 16); fout.write(buf); fout.flush(); data/nullmailer-2.2/lib/fdbuf/fdbuf_test.cc:14:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(buf, 16); fout.write(buf); fout.flush(); data/nullmailer-2.2/lib/fdbuf/fdibuf.cc:138:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool fdibuf::read(char* data, unsigned datalen) data/nullmailer-2.2/lib/fdbuf/fdibuf.cc:191:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return ::read(fd, buf, len); data/nullmailer-2.2/lib/fdbuf/fdibuf.h:35:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual bool read(char*, unsigned); data/nullmailer-2.2/lib/fdbuf/fdibuf.h:37:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool read(unsigned char* b, unsigned l) { return read((char*)b, l); } data/nullmailer-2.2/lib/fdbuf/fdibuf.h:37:52: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool read(unsigned char* b, unsigned l) { return read((char*)b, l); } data/nullmailer-2.2/lib/fdbuf/fdibuf.h:38:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool read(signed char* b, unsigned l) { return read((char*)b, l); } data/nullmailer-2.2/lib/fdbuf/fdibuf.h:38:50: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool read(signed char* b, unsigned l) { return read((char*)b, l); } data/nullmailer-2.2/lib/fdbuf/fdibuf_netstring.cc:37:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(!read(tmp, size) || !get(ch) || ch != ',') data/nullmailer-2.2/lib/fdbuf/fdobuf.h:59:18: [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). write(str, strlen(str)); data/nullmailer-2.2/lib/mystring/append.cc:18: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). append(in, strlen(in)); data/nullmailer-2.2/lib/mystring/assign.cc:16: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). assign(in, strlen(in)); data/nullmailer-2.2/lib/mystring/assign.cc:44: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). dup(in, strlen(in)); data/nullmailer-2.2/lib/mystring/find_first_of.cc:16:32: [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). return find_first_of(setstr, strlen(setstr), offset); data/nullmailer-2.2/lib/mystring/find_last_of.cc:18:31: [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). return find_last_of(setstr, strlen(setstr), offset); data/nullmailer-2.2/lib/mystring/join.cc:40:50: [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). unsigned l = node->rep ? node->rep->length : strlen(node->str); data/nullmailer-2.2/lib/mystring/starts_with.cc:11:28: [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). return starts_with(that, strlen(that)); data/nullmailer-2.2/lib/selfpipe.cc:80:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fds[0], &buf, sizeof buf) == sizeof buf) data/nullmailer-2.2/lib/setenv.cc:31:19: [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 varlen = strlen(var); data/nullmailer-2.2/lib/setenv.cc:32:19: [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 vallen = strlen(val); data/nullmailer-2.2/protocols/qmqp.cc:72:28: [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). unsigned long fullsize = strlen(itoa(size)) + 1 + size + 1 + env.length(); data/nullmailer-2.2/protocols/qmqp.cc:96:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(msg.read(buf, 4096)) data/nullmailer-2.2/protocols/smtp.cc:135:26: [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). const size_t namelen = strlen(name); data/nullmailer-2.2/protocols/smtp.cc:146:25: [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). const size_t wordlen = strlen(word); data/nullmailer-2.2/protocols/tls_gnutls.cc:98:76: [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). gnutls_wrap(gnutls_server_name_set(tls_session, GNUTLS_NAME_DNS, remote, strlen(remote)), data/nullmailer-2.2/protocols/tls_gnutls.cc:142:76: [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). gnutls_wrap(gnutls_server_name_set(tls_session, GNUTLS_NAME_DNS, remote, strlen(remote)), data/nullmailer-2.2/src/inject.cc:207:38: [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). #define X(N,IA,IR,IS,IRS,R) { #N ":",strlen(#N ":"),\ data/nullmailer-2.2/src/queue.cc:191:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(077); data/nullmailer-2.2/src/send.cc:285:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((rd = read(fd, buf, sizeof buf)) > 0) data/nullmailer-2.2/src/send.cc:446:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(trigger, buf, sizeof buf); ANALYSIS SUMMARY: Hits = 126 Lines analyzed = 8717 in approximately 0.23 seconds (37427 lines/second) Physical Source Lines of Code (SLOC) = 6785 Hits@level = [0] 0 [1] 39 [2] 62 [3] 18 [4] 3 [5] 4 Hits@level+ = [0+] 126 [1+] 126 [2+] 87 [3+] 25 [4+] 7 [5+] 4 Hits/KSLOC@level+ = [0+] 18.5704 [1+] 18.5704 [2+] 12.8224 [3+] 3.6846 [4+] 1.03169 [5+] 0.589536 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.