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/r-cran-fs-1.5.0+dfsg/src/bsd/strmode.c Examining data/r-cran-fs-1.5.0+dfsg/src/bsd/string.h Examining data/r-cran-fs-1.5.0+dfsg/src/bsd/cdefs.h Examining data/r-cran-fs-1.5.0+dfsg/src/bsd/reallocarray.c Examining data/r-cran-fs-1.5.0+dfsg/src/bsd/unistd.h Examining data/r-cran-fs-1.5.0+dfsg/src/bsd/setmode.c Examining data/r-cran-fs-1.5.0+dfsg/src/CollectorList.h Examining data/r-cran-fs-1.5.0+dfsg/src/unix/getmode.cc Examining data/r-cran-fs-1.5.0+dfsg/src/getmode.h Examining data/r-cran-fs-1.5.0+dfsg/src/error.cc Examining data/r-cran-fs-1.5.0+dfsg/src/utils.cc Examining data/r-cran-fs-1.5.0+dfsg/src/error.h Examining data/r-cran-fs-1.5.0+dfsg/src/file.cc Examining data/r-cran-fs-1.5.0+dfsg/src/init.cc Examining data/r-cran-fs-1.5.0+dfsg/src/path.cc Examining data/r-cran-fs-1.5.0+dfsg/src/utils.h Examining data/r-cran-fs-1.5.0+dfsg/src/id.cc Examining data/r-cran-fs-1.5.0+dfsg/src/dir.cc Examining data/r-cran-fs-1.5.0+dfsg/src/fs.cc Examining data/r-cran-fs-1.5.0+dfsg/src/link.cc Examining data/r-cran-fs-1.5.0+dfsg/src/getmode.cc Examining data/r-cran-fs-1.5.0+dfsg/src/windows/getmode.cc FINAL RESULTS: data/r-cran-fs-1.5.0+dfsg/src/error.cc:29:13: [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. length += vsnprintf(buf + length, BUFSIZE - length, format, ap); data/r-cran-fs-1.5.0+dfsg/src/file.cc:239:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buf, "%" PRIu64, st.st_uid); data/r-cran-fs-1.5.0+dfsg/src/file.cc:252:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buf, "%" PRIu64, st.st_gid); data/r-cran-fs-1.5.0+dfsg/src/path.cc:84:9: [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). strcpy(b, ext); data/r-cran-fs-1.5.0+dfsg/src/bsd/unistd.h:49:8: [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. #undef getopt data/r-cran-fs-1.5.0+dfsg/src/bsd/unistd.h:50:9: [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. #define getopt(argc, argv, optstr) bsd_getopt(argc, argv, optstr) data/r-cran-fs-1.5.0+dfsg/src/path.cc:134:14: [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("R_FS_HOME"))) { data/r-cran-fs-1.5.0+dfsg/src/path.cc:136: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. } else if ((env = getenv("USERPROFILE"))) { data/r-cran-fs-1.5.0+dfsg/src/path.cc:139:11: [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. env = getenv("HOMEDRIVE"); data/r-cran-fs-1.5.0+dfsg/src/path.cc:143:11: [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. env = getenv("HOMEPATH"); data/r-cran-fs-1.5.0+dfsg/src/error.cc:25: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[BUFSIZE]; data/r-cran-fs-1.5.0+dfsg/src/file.cc:238: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[20]; data/r-cran-fs-1.5.0+dfsg/src/file.cc:251: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[20]; data/r-cran-fs-1.5.0+dfsg/src/path.cc:34: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[PATH_MAX]; data/r-cran-fs-1.5.0+dfsg/src/path.cc:131: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 home[PATH_MAX] = {'\0'}; data/r-cran-fs-1.5.0+dfsg/src/unix/getmode.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 out[12]; data/r-cran-fs-1.5.0+dfsg/src/windows/getmode.cc:167: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[5]; data/r-cran-fs-1.5.0+dfsg/src/bsd/setmode.c:195:8: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(mask = umask(0)); data/r-cran-fs-1.5.0+dfsg/src/bsd/setmode.c:195:21: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(mask = umask(0)); data/r-cran-fs-1.5.0+dfsg/src/dir.cc:18:19: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). process_umask = umask(0); data/r-cran-fs-1.5.0+dfsg/src/dir.cc:105: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). else if (path[strlen(path) - 1] == '/') { data/r-cran-fs-1.5.0+dfsg/src/path.cc:69:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(b, s, str_len); data/r-cran-fs-1.5.0+dfsg/src/path.cc:82: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). if (strlen(ext) > 0) { data/r-cran-fs-1.5.0+dfsg/src/path.cc:85: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). b += strlen(ext) + 1; data/r-cran-fs-1.5.0+dfsg/src/path.cc:115:15: [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 np = strlen(p); data/r-cran-fs-1.5.0+dfsg/src/path.cc:147: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). set_path(home, env, strlen(home), PATH_MAX); data/r-cran-fs-1.5.0+dfsg/src/path.cc:156:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(home, dirname(home_str), PATH_MAX - 1); data/r-cran-fs-1.5.0+dfsg/src/path.cc:160: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). n = strlen(home); data/r-cran-fs-1.5.0+dfsg/src/path.cc:161:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(home, p, i); data/r-cran-fs-1.5.0+dfsg/src/path.cc:165: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). n = strlen(home); data/r-cran-fs-1.5.0+dfsg/src/path.cc:166:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(home, p + i, PATH_MAX - n); ANALYSIS SUMMARY: Hits = 31 Lines analyzed = 2437 in approximately 0.07 seconds (33813 lines/second) Physical Source Lines of Code (SLOC) = 1800 Hits@level = [0] 6 [1] 14 [2] 7 [3] 6 [4] 4 [5] 0 Hits@level+ = [0+] 37 [1+] 31 [2+] 17 [3+] 10 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 20.5556 [1+] 17.2222 [2+] 9.44444 [3+] 5.55556 [4+] 2.22222 [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.