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/google-authenticator-20191231/examples/demo.c Examining data/google-authenticator-20191231/src/base32.c Examining data/google-authenticator-20191231/src/base32.h Examining data/google-authenticator-20191231/src/base32_prog.c Examining data/google-authenticator-20191231/src/google-authenticator.c Examining data/google-authenticator-20191231/src/hmac.c Examining data/google-authenticator-20191231/src/hmac.h Examining data/google-authenticator-20191231/src/pam_google_authenticator.c Examining data/google-authenticator-20191231/src/sha1.c Examining data/google-authenticator-20191231/src/sha1.h Examining data/google-authenticator-20191231/src/util.c Examining data/google-authenticator-20191231/src/util.h Examining data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c FINAL RESULTS: data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:394:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:408:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:424:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:441:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:474:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:494:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:516:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:552:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:562:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. assert(!chmod(fn, 0600)); data/google-authenticator-20191231/src/google-authenticator.c:188:19: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). *encoderURL = strcat(strcpy(malloc(strlen(encoder) + data/google-authenticator-20191231/src/google-authenticator.c:188:26: [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). *encoderURL = strcat(strcpy(malloc(strlen(encoder) + data/google-authenticator-20191231/src/google-authenticator.c:247:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_BLACKONGREY); data/google-authenticator-20191231/src/google-authenticator.c:252:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_BLACKONGREY" "); data/google-authenticator-20191231/src/google-authenticator.c:257:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_BLACK); data/google-authenticator-20191231/src/google-authenticator.c:262:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_WHITE); data/google-authenticator-20191231/src/google-authenticator.c:269:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_WHITE); data/google-authenticator-20191231/src/google-authenticator.c:274:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_BLACKONGREY); data/google-authenticator-20191231/src/google-authenticator.c:283:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_BLACKONGREY); data/google-authenticator-20191231/src/google-authenticator.c:289:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_BLACKONGREY" "); data/google-authenticator-20191231/src/google-authenticator.c:298:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(UTF8_BOTH); data/google-authenticator-20191231/src/google-authenticator.c:300:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(UTF8_TOPHALF); data/google-authenticator-20191231/src/google-authenticator.c:304:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(UTF8_BOTTOMHALF); data/google-authenticator-20191231/src/google-authenticator.c:312:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ANSI_BLACKONGREY); data/google-authenticator-20191231/src/google-authenticator.c:738:13: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). label = strcat(strcat(strcpy(malloc(strlen(user) + strlen(hostname) + 2), data/google-authenticator-20191231/src/google-authenticator.c:738:27: [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). label = strcat(strcat(strcpy(malloc(strlen(user) + strlen(hostname) + 2), data/google-authenticator-20191231/src/google-authenticator.c:801:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(secret, totp); data/google-authenticator-20191231/src/google-authenticator.c:803:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(secret, hotp); data/google-authenticator-20191231/src/google-authenticator.c:843:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(strcpy(secret_fn, home), SECRET); data/google-authenticator-20191231/src/google-authenticator.c:843:12: [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). strcat(strcpy(secret_fn, home), SECRET); data/google-authenticator-20191231/src/pam_google_authenticator.c:118:5: [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. vsnprintf(buf, sizeof buf, format, args); data/google-authenticator-20191231/src/pam_google_authenticator.c:1276:5: [4] (format) snprintf: 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. snprintf(pos, resized_size-(pos-disallow), " %d" + !*disallow, tm); data/google-authenticator-20191231/src/pam_google_authenticator.c:1439:9: [4] (format) snprintf: 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. snprintf(pos, reset_size-(pos-reset), " %d%+d" + !*reset, tms[i], skews[i]); data/google-authenticator-20191231/src/pam_google_authenticator.c:1648: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 the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(line, match, &when) == 1) { data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:60:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). : strcat(strcpy(malloc(sizeof(pw) + strlen(response)), pw), response); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:60:16: [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). : strcat(strcpy(malloc(sizeof(pw) + strlen(response)), pw), response); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:105:17: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). *item = strcat(strcpy(authtok, pw), response); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:105:24: [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). *item = strcat(strcpy(authtok, pw), response); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:257:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(strcpy((char *)targv[0], "secret="), fn); data/google-authenticator-20191231/examples/demo.c:104: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. char *user = getenv("USER"); data/google-authenticator-20191231/src/base32_prog.c:84:15: [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, "edDh")) != -1) { data/google-authenticator-20191231/src/google-authenticator.c:495:19: [3] (buffer) getopt_long: 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. const int c = getopt_long(argc, argv, optstring, options, &idx); data/google-authenticator-20191231/src/google-authenticator.c:833: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. const char *home = getenv("HOME"); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:87: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. char *user = getenv("USER"); data/google-authenticator-20191231/examples/demo.c:157: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("/dev/tty", O_RDWR); data/google-authenticator-20191231/src/base32_prog.c:115:62: [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). const int d = strcmp(binfile, "-") == 0 ? STDIN_FILENO : open(binfile, O_RDONLY); data/google-authenticator-20191231/src/google-authenticator.c:352: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 line[128]; data/google-authenticator-20191231/src/google-authenticator.c:373: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[128]; data/google-authenticator-20191231/src/google-authenticator.c:404: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(scratchCodes, option, strlen(option)); data/google-authenticator-20191231/src/google-authenticator.c:448: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 secret[(SECRET_BITS + BITS_PER_BASE32_CHAR-1)/BITS_PER_BASE32_CHAR + data/google-authenticator-20191231/src/google-authenticator.c:734: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 hostname[128] = { 0 }; data/google-authenticator-20191231/src/google-authenticator.c:736:7: [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(hostname, "unix"); data/google-authenticator-20191231/src/google-authenticator.c:743: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 hostname[128] = { 0 }; data/google-authenticator-20191231/src/google-authenticator.c:745:7: [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(hostname, "unix"); data/google-authenticator-20191231/src/google-authenticator.c:751: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("/dev/urandom", O_RDONLY); data/google-authenticator-20191231/src/google-authenticator.c:846: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 s[1024]; data/google-authenticator-20191231/src/google-authenticator.c:874: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 s[80]; data/google-authenticator-20191231/src/google-authenticator.c:895: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 s[80]; data/google-authenticator-20191231/src/google-authenticator.c:912: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 s[80]; data/google-authenticator-20191231/src/google-authenticator.c:925: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 s[80]; data/google-authenticator-20191231/src/google-authenticator.c:930:8: [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). fd = open(tmp_fn, O_WRONLY|O_EXCL|O_CREAT|O_NOFOLLOW|O_TRUNC, 0400); data/google-authenticator-20191231/src/hmac.c:74: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(result, sha, resultLength); data/google-authenticator-20191231/src/pam_google_authenticator.c:103: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 logname[80]; data/google-authenticator-20191231/src/pam_google_authenticator.c:117: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[1000]; data/google-authenticator-20191231/src/pam_google_authenticator.c:427: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(secret_filename, O_RDONLY); data/google-authenticator-20191231/src/pam_google_authenticator.c:467: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[80]; data/google-authenticator-20191231/src/pam_google_authenticator.c:596:8: [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). fd = mkstemp(tmp_filename); data/google-authenticator-20191231/src/pam_google_authenticator.c:706: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(secret, buf, base32Len); data/google-authenticator-20191231/src/pam_google_authenticator.c:759: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(val, ptr, val_len); data/google-authenticator-20191231/src/pam_google_authenticator.c:819: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(resized, *buf, start - *buf); data/google-authenticator-20191231/src/pam_google_authenticator.c:820: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(resized + (start - *buf) + total_len, stop, tail_len + 1); data/google-authenticator-20191231/src/pam_google_authenticator.c:830: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(start + 2, key, key_len); data/google-authenticator-20191231/src/pam_google_authenticator.c:832: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(start+3+key_len, val, val_len); data/google-authenticator-20191231/src/pam_google_authenticator.c:1421: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 time_skew[40]; data/google-authenticator-20191231/src/pam_google_authenticator.c:1434: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 reset[reset_size]; data/google-authenticator-20191231/src/pam_google_authenticator.c:1576: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 host[256]; data/google-authenticator-20191231/src/pam_google_authenticator.c:1607: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 value[255+23+1]; data/google-authenticator-20191231/src/pam_google_authenticator.c:1629: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 match[128]; data/google-authenticator-20191231/src/pam_google_authenticator.c:1694: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 counter_str[40]; data/google-authenticator-20191231/src/pam_google_authenticator.c:2056: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 counter_str[40]; data/google-authenticator-20191231/src/pam_google_authenticator.c:2094: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 s[1024]; data/google-authenticator-20191231/src/sha1.c:252: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(((uint8_t *) sha1_info->data) + sha1_info->local, buffer, i); data/google-authenticator-20191231/src/sha1.c:263: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(sha1_info->data, buffer, SHA1_BLOCKSIZE); data/google-authenticator-20191231/src/sha1.c:268: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(sha1_info->data, buffer, count); data/google-authenticator-20191231/src/sha1.c:274:34: [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. sha1_transform_and_copy(unsigned char digest[20], SHA1_INFO *sha1_info) data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:243: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(fn); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:257:12: [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. strcat(strcpy((char *)targv[0], "secret="), fn); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:257:20: [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. strcat(strcpy((char *)targv[0], "secret="), fn); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:395: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). assert((fd = open(fn, O_APPEND | O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:409: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). assert((fd = open(fn, O_TRUNC | O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:425: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). assert((fd = open(fn, O_APPEND | O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:442: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). assert((fd = open(fn, O_APPEND | O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:454: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 buf[7]; data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:456:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(response, "%06d", compute_code(binary_secret, data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:463: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). assert((fd = open(fn, O_RDONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:464: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 state_file_buf[4096] = { 0 }; data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:475: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). assert((fd = open(fn, O_APPEND | O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:483: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 buf[7]; data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:485:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(response, "%06d", data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:495: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). assert((fd = open(fn, O_RDWR)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:517: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). assert((fd = open(fn, O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:526: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 buf[7]; data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:528:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(response, "%06d", data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:537: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[7]; data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:539:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(response, "%06d", compute_code(binary_secret, data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:553: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). assert((fd = open(fn, O_APPEND | O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:563: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). assert((fd = open(fn, O_TRUNC | O_WRONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:576: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). assert((fd = open(fn, O_RDONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:591: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). assert((fd = open(fn, O_RDONLY)) >= 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:608: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). assert((fd = open(fn, O_RDONLY)) >= 0); data/google-authenticator-20191231/src/base32_prog.c:137:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((amt_read = read(d, input, amt_to_read)) > 0 || errno == EINTR) { data/google-authenticator-20191231/src/base32_prog.c:178:30: [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 int result_avail = strlen(base32_value) + 1; data/google-authenticator-20191231/src/base32_prog.c:179:24: [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 (result_avail < strlen(base32_value)) { data/google-authenticator-20191231/src/google-authenticator.c:59: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). int secretLen = (strlen(key) + 7)/8*BITS_PER_BASE32_CHAR; data/google-authenticator-20191231/src/google-authenticator.c:126:27: [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 size = 3 * strlen(s) + 1; data/google-authenticator-20191231/src/google-authenticator.c:152: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). char* newret = realloc(ret, strlen(ret) + 1); data/google-authenticator-20191231/src/google-authenticator.c:169: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). if (issuer != NULL && strlen(issuer) > 0) { data/google-authenticator-20191231/src/google-authenticator.c:188: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). *encoderURL = strcat(strcpy(malloc(strlen(encoder) + data/google-authenticator-20191231/src/google-authenticator.c:189: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). strlen(encodedURL) + 1), data/google-authenticator-20191231/src/google-authenticator.c:398:10: [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). assert(strlen(buf) + strlen(option) < nbuf); data/google-authenticator-20191231/src/google-authenticator.c:398:24: [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). assert(strlen(buf) + strlen(option) < nbuf); data/google-authenticator-20191231/src/google-authenticator.c:402: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). memmove(scratchCodes + strlen(option), scratchCodes, data/google-authenticator-20191231/src/google-authenticator.c:403:11: [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). strlen(scratchCodes) + 1); data/google-authenticator-20191231/src/google-authenticator.c:404: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). memcpy(scratchCodes, option, strlen(option)); data/google-authenticator-20191231/src/google-authenticator.c:738:20: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. label = strcat(strcat(strcpy(malloc(strlen(user) + strlen(hostname) + 2), data/google-authenticator-20191231/src/google-authenticator.c:738:41: [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). label = strcat(strcat(strcpy(malloc(strlen(user) + strlen(hostname) + 2), data/google-authenticator-20191231/src/google-authenticator.c:738:56: [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). label = strcat(strcat(strcpy(malloc(strlen(user) + strlen(hostname) + 2), data/google-authenticator-20191231/src/google-authenticator.c:756:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { data/google-authenticator-20191231/src/google-authenticator.c:799:3: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(secret, "\n"); data/google-authenticator-20191231/src/google-authenticator.c:819:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, buf + (SECRET_BITS/8 + BYTES_PER_SCRATCHCODE*i), data/google-authenticator-20191231/src/google-authenticator.c:828:56: [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). snprintf(strrchr(secret, '\000'), sizeof(secret) - strlen(secret), data/google-authenticator-20191231/src/google-authenticator.c:838:24: [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). secret_fn = malloc(strlen(home) + strlen(SECRET) + 1); data/google-authenticator-20191231/src/google-authenticator.c:838:39: [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). secret_fn = malloc(strlen(home) + strlen(SECRET) + 1); data/google-authenticator-20191231/src/google-authenticator.c:854: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). const int size = strlen(secret_fn) + 3; data/google-authenticator-20191231/src/google-authenticator.c:936: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). if (write(fd, secret, strlen(secret)) != (ssize_t)strlen(secret) || data/google-authenticator-20191231/src/google-authenticator.c:936:53: [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 (write(fd, secret, strlen(secret)) != (ssize_t)strlen(secret) || data/google-authenticator-20191231/src/pam_google_authenticator.c:119:24: [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 int newlen = strlen(error_msg) + 1 + strlen(buf) + 1; data/google-authenticator-20191231/src/pam_google_authenticator.c:119:48: [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 int newlen = strlen(error_msg) + 1 + strlen(buf) + 1; data/google-authenticator-20191231/src/pam_google_authenticator.c:122:48: [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). snprintf(n, newlen, "%s%s%s", error_msg, strlen(error_msg)?"\n":"",buf); data/google-authenticator-20191231/src/pam_google_authenticator.c:250:68: [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). log_message(LOG_ERR, pamh, "Short (%d) mem allocation failed", strlen(spec)); data/google-authenticator-20191231/src/pam_google_authenticator.c:285: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). const size_t subst_len = strlen(subst); data/google-authenticator-20191231/src/pam_google_authenticator.c:292: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). strlen(secret_filename) + subst_len + 1); data/google-authenticator-20191231/src/pam_google_authenticator.c:299:47: [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). memmove(var + subst_len, var + var_len, strlen(var + var_len) + 1); data/google-authenticator-20191231/src/pam_google_authenticator.c:508:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (filesize != read(*fd, buf, filesize)) { data/google-authenticator-20191231/src/pam_google_authenticator.c:582:27: [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 fnlength = strlen(secret_filename) + 1 + 6 + 1; data/google-authenticator-20191231/src/pam_google_authenticator.c:595:27: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). const mode_t old_mask = umask(077); data/google-authenticator-20191231/src/pam_google_authenticator.c:597:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_mask); data/google-authenticator-20191231/src/pam_google_authenticator.c:638:34: [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 ((err = full_write(fd, buf, strlen(buf)))) { data/google-authenticator-20191231/src/pam_google_authenticator.c:746: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 key_len = strlen(key); data/google-authenticator-20191231/src/pam_google_authenticator.c:773: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 key_len = strlen(key); data/google-authenticator-20191231/src/pam_google_authenticator.c:801: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 val_len = strlen(val); data/google-authenticator-20191231/src/pam_google_authenticator.c:806:29: [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 tail_len = strlen(stop); data/google-authenticator-20191231/src/pam_google_authenticator.c:812: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). const size_t buf_len = strlen(*buf); data/google-authenticator-20191231/src/pam_google_authenticator.c:844: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). size_t tail_len = strlen(stop); data/google-authenticator-20191231/src/pam_google_authenticator.c:1138: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). memmove(ptr, endptr, strlen(endptr) + 1); data/google-authenticator-20191231/src/pam_google_authenticator.c:1257: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). memmove(ptr, endptr, strlen(endptr) + 1); data/google-authenticator-20191231/src/pam_google_authenticator.c:1265:33: [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 resized_size = strlen(disallow) + 40; data/google-authenticator-20191231/src/pam_google_authenticator.c:1757:24: [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 (perm == 0 || strlen(remainder) != 0) { data/google-authenticator-20191231/src/pam_google_authenticator.c:1905:30: [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). explicit_bzero(pw, strlen(pw)); data/google-authenticator-20191231/src/pam_google_authenticator.c:1948: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 int pw_len = strlen(pw); data/google-authenticator-20191231/src/pam_google_authenticator.c:2045: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). explicit_bzero(pw,strlen(pw)); data/google-authenticator-20191231/src/pam_google_authenticator.c:2049: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). explicit_bzero(saved_pw, strlen(saved_pw)); data/google-authenticator-20191231/src/pam_google_authenticator.c:2138: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). explicit_bzero(buf, strlen(buf)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:60: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). : strcat(strcpy(malloc(sizeof(pw) + strlen(response)), pw), response); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:104:49: [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). authtok = realloc(authtok, sizeof(pw) + strlen(response)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:242:25: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t orig_umask = umask(S_IRWXG|S_IRWXO); // Only for the current user. data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:244:11: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(orig_umask); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:256:36: [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 char *targv[] = { malloc(strlen(fn) + 8), NULL, NULL, NULL, NULL }; data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:465:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(fd, state_file_buf, sizeof(state_file_buf)-1) > 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:497:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(fd, state_file_buf, sizeof(state_file_buf)-1) > 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:508: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). assert(write(fd, state_file_buf, strlen(state_file_buf)) == data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:509:12: [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). strlen(state_file_buf)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:518: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). assert(write(fd, state_file_buf, strlen(state_file_buf)) == data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:519:12: [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). strlen(state_file_buf)); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:578:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(fd, state_file_buf, sizeof(state_file_buf)-1) > 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:593:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(fd, state_file_buf, sizeof(state_file_buf)-1) > 0); data/google-authenticator-20191231/tests/pam_google_authenticator_unittest.c:610:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read(fd, state_file_buf, sizeof(state_file_buf)-1) > 0); ANALYSIS SUMMARY: Hits = 176 Lines analyzed = 4843 in approximately 0.18 seconds (26987 lines/second) Physical Source Lines of Code (SLOC) = 3729 Hits@level = [0] 97 [1] 67 [2] 66 [3] 5 [4] 29 [5] 9 Hits@level+ = [0+] 273 [1+] 176 [2+] 109 [3+] 43 [4+] 38 [5+] 9 Hits/KSLOC@level+ = [0+] 73.21 [1+] 47.1976 [2+] 29.2304 [3+] 11.5312 [4+] 10.1904 [5+] 2.41352 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.