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/msktutil-1.1/krb5wrap.cpp
Examining data/msktutil-1.1/msktkrb5.cpp
Examining data/msktutil-1.1/msktldap.cpp
Examining data/msktutil-1.1/msktname.cpp
Examining data/msktutil-1.1/msktpass.cpp
Examining data/msktutil-1.1/msktconf.cpp
Examining data/msktutil-1.1/ldapconnection.cpp
Examining data/msktutil-1.1/strtoll.c
Examining data/msktutil-1.1/msktutil.h
Examining data/msktutil-1.1/msktname.h
Examining data/msktutil-1.1/krb5wrap.h
Examining data/msktutil-1.1/ldapconnection.h
Examining data/msktutil-1.1/msktutil.cpp

FINAL RESULTS:

data/msktutil-1.1/ldapconnection.cpp:41:98:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define VERBOSEldap(text...) if (g_verbose > 1) { fprintf(stderr, " ###### %s: ", __FUNCTION__); fprintf(stderr, ## text); fprintf(stderr, "\n"); }
data/msktutil-1.1/msktconf.cpp:344: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.
            access(flags->keytab_file.c_str(), R_OK) == 0 &&
data/msktutil-1.1/msktconf.cpp:350: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(flags->keytab_file.c_str(), R_OK) == 0 &&
data/msktutil-1.1/msktconf.cpp:356: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(flags->keytab_file.c_str(), R_OK) == 0 &&
data/msktutil-1.1/msktconf.cpp:362: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(flags->keytab_file.c_str(), R_OK) == 0 &&
data/msktutil-1.1/msktpass.cpp:106:18:  [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("net changesecretpw -f -i", "w");
data/msktutil-1.1/msktutil.cpp:52:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf(stderr, format, args);
data/msktutil-1.1/msktutil.cpp:67:19:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    int result =  vsnprintf(buf, 10000-1, format, args);
data/msktutil-1.1/msktutil.cpp:69:36:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#   error need either vasprintf or vsnprintf
data/msktutil-1.1/msktutil.h:291:86:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define VERBOSE(text...) if (g_verbose) { fprintf(stdout, " -- %s: ", __FUNCTION__); fprintf(stdout, ## text); fprintf(stdout, "\n"); }
data/msktutil-1.1/msktutil.cpp:1343: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.
    if (getenv("MSKTUTIL_KEYTAB")) {
data/msktutil-1.1/msktutil.cpp:1344:23:  [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.
        keytab_file = getenv("MSKTUTIL_KEYTAB");
data/msktutil-1.1/msktutil.cpp:1346: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.
    if (getenv("MSKTUTIL_NO_PAC")) {
data/msktutil-1.1/msktutil.cpp:1349: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.
    if (getenv("MSKTUTIL_DELEGATION")) {
data/msktutil-1.1/msktutil.cpp:1352: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.
    if (getenv("MSKTUTIL_LDAP_BASE")) {
data/msktutil-1.1/msktutil.cpp:1353: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.
        ldap_ou = getenv("MSKTUTIL_LDAP_BASE");
data/msktutil-1.1/msktutil.cpp:1355: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.
    if (getenv("MSKTUTIL_SERVER")) {
data/msktutil-1.1/msktutil.cpp:1356:18:  [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.
        server = getenv("MSKTUTIL_SERVER");
data/msktutil-1.1/ldapconnection.cpp:341:25:  [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 **mv = new char *[2];
data/msktutil-1.1/ldapconnection.cpp:368:21:  [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 **mv = new char *[val.size() + 1];
data/msktutil-1.1/msktconf.cpp:83:14:  [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(template_arr);
data/msktutil-1.1/msktkrb5.cpp:38: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 keytab_name[MAX_KEYTAB_NAME_LEN];
data/msktutil-1.1/msktldap.cpp:179:32:  [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).
            kvno = (krb5_kvno) atoi(kvno_str.c_str());
data/msktutil-1.1/msktldap.cpp:576:40:  [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).
        flags->ad_userAccountControl = atoi(uac.c_str());
data/msktutil-1.1/msktldap.cpp:584:46:  [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).
        flags->ad_supportedEncryptionTypes = atoi(supportedEncryptionTypes.c_str());
data/msktutil-1.1/msktname.cpp:157:9:  [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(&(addr.sin_addr.s_addr), host->h_addr_list[i], host->h_length);
data/msktutil-1.1/msktname.cpp:225:14:  [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 response[NS_MAXMSG];
data/msktutil-1.1/msktname.h:89: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.
        char name[NS_MAXDNAME];
data/msktutil-1.1/msktpass.cpp:61:10:  [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).
    fp = fopen("/dev/urandom", "r");
data/msktutil-1.1/msktutil.cpp:1133:47:  [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).
                flags->auto_update_interval = atoi(argv[i]);
data/msktutil-1.1/msktutil.cpp:1146:39:  [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).
                flags->cleanup_days = atoi(argv[i]);
data/msktutil-1.1/ldapconnection.cpp:51:43:  [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).
        interact->len = (dflt && *dflt) ? strlen(dflt) : 0;
data/msktutil-1.1/msktconf.cpp:371: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).
        if (strlen(flags->old_account_password.c_str())) {
data/msktutil-1.1/msktname.cpp:322:17:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    return std::equal(suffix.rbegin(), suffix.rend(), str.rbegin());
data/msktutil-1.1/msktpass.cpp:79:29:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                if ((curr = getc(fp)) == EOF) {
data/msktutil-1.1/msktutil.cpp:1189: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).
    if (strlen(flags->old_account_password.c_str()) &&

ANALYSIS SUMMARY:

Hits = 36
Lines analyzed = 5300 in approximately 0.18 seconds (29770 lines/second)
Physical Source Lines of Code (SLOC) = 3972
Hits@level = [0] 226 [1]   5 [2]  13 [3]   8 [4]  10 [5]   0
Hits@level+ = [0+] 262 [1+]  36 [2+]  31 [3+]  18 [4+]  10 [5+]   0
Hits/KSLOC@level+ = [0+] 65.9617 [1+] 9.06344 [2+] 7.80463 [3+] 4.53172 [4+] 2.51762 [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.