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/s3fs-fuse-1.87/src/addhead.cpp Examining data/s3fs-fuse-1.87/src/addhead.h Examining data/s3fs-fuse-1.87/src/cache.cpp Examining data/s3fs-fuse-1.87/src/cache.h Examining data/s3fs-fuse-1.87/src/common.h Examining data/s3fs-fuse-1.87/src/common_auth.cpp Examining data/s3fs-fuse-1.87/src/curl.cpp Examining data/s3fs-fuse-1.87/src/curl.h Examining data/s3fs-fuse-1.87/src/fdcache.cpp Examining data/s3fs-fuse-1.87/src/fdcache.h Examining data/s3fs-fuse-1.87/src/gnutls_auth.cpp Examining data/s3fs-fuse-1.87/src/nss_auth.cpp Examining data/s3fs-fuse-1.87/src/openssl_auth.cpp Examining data/s3fs-fuse-1.87/src/psemaphore.h Examining data/s3fs-fuse-1.87/src/s3fs.cpp Examining data/s3fs-fuse-1.87/src/s3fs.h Examining data/s3fs-fuse-1.87/src/s3fs_auth.h Examining data/s3fs-fuse-1.87/src/s3fs_util.cpp Examining data/s3fs-fuse-1.87/src/s3fs_util.h Examining data/s3fs-fuse-1.87/src/sighandlers.cpp Examining data/s3fs-fuse-1.87/src/sighandlers.h Examining data/s3fs-fuse-1.87/src/string_util.cpp Examining data/s3fs-fuse-1.87/src/string_util.h Examining data/s3fs-fuse-1.87/src/test_string_util.cpp Examining data/s3fs-fuse-1.87/src/test_util.h FINAL RESULTS: data/s3fs-fuse-1.87/src/common.h:133:10: [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. fprintf(fp, fmt "%s\n", __VA_ARGS__); \ data/s3fs-fuse-1.87/src/fdcache.cpp:2740:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(szBuff, NOCACHE_PATH_PREFIX_FORM, random()); // worry for performance, but maybe don't worry. data/s3fs-fuse-1.87/src/s3fs.cpp:3327:7: [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(setpos, xiter->first.c_str()); data/s3fs-fuse-1.87/src/curl.cpp:812:28: [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* CURL_CA_BUNDLE = getenv("CURL_CA_BUNDLE"); data/s3fs-fuse-1.87/src/curl.cpp:1200: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. char* envkeys = getenv("AWSSSECKEYS"); data/s3fs-fuse-1.87/src/curl.cpp:1221: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* envkmsid = getenv("AWSSSEKMSID"); data/s3fs-fuse-1.87/src/curl.cpp:2881:42: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. string Signature = CalcSignature(op, realpath, query_string + (type == REQTYPE_PREMULTIPOST || type == REQTYPE_MULTILIST ? "=" : ""), strdate, contentSHA256, date8601); data/s3fs-fuse-1.87/src/curl.cpp:2989:49: [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. url = string(S3fsCurl::IAM_cred_url) + std::getenv(ECS_IAM_ENV_VAR.c_str()); data/s3fs-fuse-1.87/src/curl.cpp:4819:34: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. bool MakeUrlResource(const char* realpath, string& resourcepath, string& url) data/s3fs-fuse-1.87/src/curl.cpp:4821:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if(!realpath){ data/s3fs-fuse-1.87/src/curl.cpp:4824:52: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. resourcepath = urlEncode(service_path + bucket + realpath); data/s3fs-fuse-1.87/src/curl.h:598:34: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. bool MakeUrlResource(const char* realpath, std::string& resourcepath, std::string& url); data/s3fs-fuse-1.87/src/fdcache.cpp:2740:45: [3] (random) random: 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. sprintf(szBuff, NOCACHE_PATH_PREFIX_FORM, random()); // worry for performance, but maybe don't worry. data/s3fs-fuse-1.87/src/s3fs.cpp:4274:30: [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* AWSACCESSKEYID = getenv("AWSACCESSKEYID"); data/s3fs-fuse-1.87/src/s3fs.cpp:4275:30: [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* AWSSECRETACCESSKEY = getenv("AWSSECRETACCESSKEY"); data/s3fs-fuse-1.87/src/s3fs.cpp:4276:30: [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* AWSSESSIONTOKEN = getenv("AWSSESSIONTOKEN"); data/s3fs-fuse-1.87/src/s3fs.cpp:4306:25: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. AWS_CREDENTIAL_FILE = getenv("AWS_CREDENTIAL_FILE"); data/s3fs-fuse-1.87/src/s3fs.cpp:4332:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. HOME = getenv ("HOME"); data/s3fs-fuse-1.87/src/s3fs.cpp:5152:15: [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. while((ch = getopt_long(argc, argv, "dho:fsu", long_opts, &option_index)) != -1){ data/s3fs-fuse-1.87/src/s3fs_util.cpp:67:10: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. return realpath; data/s3fs-fuse-1.87/src/addhead.cpp:134: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 errbuf[256]; data/s3fs-fuse-1.87/src/common_auth.cpp:73: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 sha256[2 * digestlen + 1]; data/s3fs-fuse-1.87/src/curl.cpp:71:20: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(NULL == (fp = tmpfile())){ data/s3fs-fuse-1.87/src/curl.cpp:242: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(&text[lastpos], ptr, bytes); data/s3fs-fuse-1.87/src/curl.cpp:855: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). BF.open("/etc/ssl/certs/ca-certificates.crt"); data/s3fs-fuse-1.87/src/curl.cpp:860:10: [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). BF.open("/usr/share/ssl/certs/ca-bundle.crt"); data/s3fs-fuse-1.87/src/curl.cpp:865: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). BF.open("/usr/local/share/certs/ca-root.crt"); data/s3fs-fuse-1.87/src/curl.cpp:902: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, pCurl->postdata, copysize); data/s3fs-fuse-1.87/src/curl.cpp:2784: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 kSecret[128]; data/s3fs-fuse-1.87/src/curl.cpp:2787: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 hexsRequest[64 + 1]; data/s3fs-fuse-1.87/src/curl.cpp:2803: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(&hexsRequest[cnt * 2], "%02x", sRequest[cnt]); data/s3fs-fuse-1.87/src/curl.cpp:2820: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(&hexSig[cnt * 2], "%02x", md[cnt]); data/s3fs-fuse-1.87/src/curl.cpp:2845: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 hexsRequest[64 + 1]; data/s3fs-fuse-1.87/src/curl.cpp:2849:9: [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(&hexsRequest[cnt * 2], "%02x", sRequest[cnt]); data/s3fs-fuse-1.87/src/fdcache.cpp:267:20: [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(-1 == (fd = open(sfile_path.c_str(), O_RDONLY))){ data/s3fs-fuse-1.87/src/fdcache.cpp:272:20: [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(-1 == (fd = open(sfile_path.c_str(), O_CREAT|O_RDWR, 0600))){ data/s3fs-fuse-1.87/src/fdcache.cpp:1222:12: [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 bytes[1024 * 32]; // 32kb data/s3fs-fuse-1.87/src/fdcache.cpp:1438:26: [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(-1 != (urandom_fd = open("/dev/urandom", O_RDONLY))){ data/s3fs-fuse-1.87/src/fdcache.cpp:1451: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 szfile[NAME_MAX + 1]; data/s3fs-fuse-1.87/src/fdcache.cpp:1452: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(szfile, "%x.tmp", rand_r(&seed)); data/s3fs-fuse-1.87/src/fdcache.cpp:1468:24: [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(-1 == (mirrorfd = open(mirrorpath.c_str(), O_RDWR))){ data/s3fs-fuse-1.87/src/fdcache.cpp:1543: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( -1 != (fd = open(cachepath.c_str(), O_RDWR)) && data/s3fs-fuse-1.87/src/fdcache.cpp:1579:22: [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(-1 == (fd = open(cachepath.c_str(), O_CREAT|O_RDWR|O_TRUNC, 0600))){ data/s3fs-fuse-1.87/src/fdcache.cpp:1634:25: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(NULL == (pfile = tmpfile()) || -1 ==(fd = fileno(pfile))){ data/s3fs-fuse-1.87/src/fdcache.cpp:2031:24: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(NULL == (ptmpfp = tmpfile()) || -1 ==(tmpfd = fileno(ptmpfp))){ data/s3fs-fuse-1.87/src/fdcache.cpp:2738: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 szBuff[64]; data/s3fs-fuse-1.87/src/fdcache.cpp:3294:33: [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(-1 == (cache_file_fd = open(cache_path.c_str(), O_RDONLY))){ data/s3fs-fuse-1.87/src/fdcache.cpp:3380:22: [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). if(NULL == (fp = fopen(FdManager::check_cache_output.c_str(), "a+"))){ data/s3fs-fuse-1.87/src/gnutls_auth.cpp:195:12: [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 buf[512]; data/s3fs-fuse-1.87/src/gnutls_auth.cpp:228: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[512]; data/s3fs-fuse-1.87/src/gnutls_auth.cpp:262: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, gcry_md_read(ctx_md5, 0), get_md5_digest_length()); data/s3fs-fuse-1.87/src/gnutls_auth.cpp:295:12: [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 buf[512]; data/s3fs-fuse-1.87/src/gnutls_auth.cpp:337: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(*digest, gcry_md_read(ctx_sha256, 0), *digestlen); data/s3fs-fuse-1.87/src/gnutls_auth.cpp:347: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[512]; data/s3fs-fuse-1.87/src/gnutls_auth.cpp:381: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, gcry_md_read(ctx_sha256, 0), get_sha256_digest_length()); data/s3fs-fuse-1.87/src/nss_auth.cpp:99:12: [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 tmpdigest[64]; data/s3fs-fuse-1.87/src/nss_auth.cpp:131: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(*digest, tmpdigest, *digestlen); data/s3fs-fuse-1.87/src/nss_auth.cpp:157:12: [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 buf[512]; data/s3fs-fuse-1.87/src/nss_auth.cpp:223:12: [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 buf[512]; data/s3fs-fuse-1.87/src/openssl_auth.cpp:260: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[512]; data/s3fs-fuse-1.87/src/openssl_auth.cpp:323: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[512]; data/s3fs-fuse-1.87/src/s3fs.cpp:928:26: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(NULL == (ptmpfp = tmpfile()) || data/s3fs-fuse-1.87/src/s3fs.cpp:3091: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(pval->pvalue, value, size); data/s3fs-fuse-1.87/src/s3fs.cpp:3260: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(value, pvalue, length); data/s3fs-fuse-1.87/src/s3fs_util.cpp:762: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 sysname[512]; data/s3fs-fuse-1.87/src/s3fs_util.cpp:767: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(sysname, "Linux"); data/s3fs-fuse-1.87/src/string_util.cpp:270: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/s3fs-fuse-1.87/src/string_util.cpp:286: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/s3fs-fuse-1.87/src/string_util.cpp:294: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/s3fs-fuse-1.87/src/string_util.cpp: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 hexbuf[3]; data/s3fs-fuse-1.87/src/string_util.cpp:390:12: [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 parts[4]; data/s3fs-fuse-1.87/src/string_util.cpp:438:12: [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 parts[4]; data/s3fs-fuse-1.87/src/addhead.cpp:121:54: [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(0 == strncasecmp(key.c_str(), ADD_HEAD_REGEX, strlen(ADD_HEAD_REGEX))){ data/s3fs-fuse-1.87/src/addhead.cpp:123: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(key.size() <= strlen(ADD_HEAD_REGEX)){ data/s3fs-fuse-1.87/src/addhead.cpp:128: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). key = key.substr(strlen(ADD_HEAD_REGEX)); data/s3fs-fuse-1.87/src/addhead.cpp:194:23: [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 pathlength = strlen(path); data/s3fs-fuse-1.87/src/cache.cpp:599: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). if(0 < strlen(key) && 0 != strcmp(key, "/")){ data/s3fs-fuse-1.87/src/curl.cpp:2842: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). unsigned int cRequest_len = strlen(reinterpret_cast<const char *>(b_postdata)); data/s3fs-fuse-1.87/src/fdcache.cpp:1440:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(sizeof(rand_data) == read(urandom_fd, &rand_data, sizeof(rand_data))){ data/s3fs-fuse-1.87/src/s3fs.cpp:804: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). if('/' != path[strlen(path) - 1]){ data/s3fs-fuse-1.87/src/s3fs.cpp:911:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, strValue.c_str(), size); data/s3fs-fuse-1.87/src/s3fs.cpp:2560:23: [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(delimiter && 0 < strlen(delimiter)){ data/s3fs-fuse-1.87/src/s3fs.cpp:2900:21: [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(dirpath && 0 < strlen(dirpath)){ data/s3fs-fuse-1.87/src/s3fs.cpp:2921: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). }else if(basepath && 0 < strlen(basepath) && '/' == basepath[strlen(basepath) - 1] && 0 == strncmp(dirpath, basepath, strlen(basepath) - 1)){ data/s3fs-fuse-1.87/src/s3fs.cpp:2921: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). }else if(basepath && 0 < strlen(basepath) && '/' == basepath[strlen(basepath) - 1] && 0 == strncmp(dirpath, basepath, strlen(basepath) - 1)){ data/s3fs-fuse-1.87/src/s3fs.cpp:2921:125: [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(basepath && 0 < strlen(basepath) && '/' == basepath[strlen(basepath) - 1] && 0 == strncmp(dirpath, basepath, strlen(basepath) - 1)){ data/s3fs-fuse-1.87/src/s3fs.cpp:2923: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). if(strlen(dirpath) > strlen(basepath)){ data/s3fs-fuse-1.87/src/s3fs.cpp:2923: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). if(strlen(dirpath) > strlen(basepath)){ data/s3fs-fuse-1.87/src/s3fs.cpp:2924: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). withdirname = &dirpath[strlen(basepath)]; data/s3fs-fuse-1.87/src/s3fs.cpp:3328: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). setpos = &setpos[strlen(setpos) + 1]; data/s3fs-fuse-1.87/src/s3fs.cpp:4406: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). if(0 == strlen(pmount_prefix) || '/' != pmount_prefix[0]){ data/s3fs-fuse-1.87/src/s3fs.cpp:4650: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). kmsid = &arg[strlen("use_sse=kmsid:")]; data/s3fs-fuse-1.87/src/s3fs.cpp:4652: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). kmsid = &arg[strlen("use_sse=k:")]; data/s3fs-fuse-1.87/src/s3fs.cpp:4679: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). ssecfile = &arg[strlen("use_sse=custom:")]; data/s3fs-fuse-1.87/src/s3fs.cpp:4681: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). ssecfile = &arg[strlen("use_sse=c:")]; data/s3fs-fuse-1.87/src/s3fs.cpp:4691:37: [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* ssecfile = &arg[strlen("use_sse=")]; data/s3fs-fuse-1.87/src/s3fs.cpp:4708:35: [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* ssecfile = &arg[strlen("load_sse_c=")]; data/s3fs-fuse-1.87/src/s3fs_util.cpp:771:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sysname, sysinfo.sysname, sizeof(sysname) - 1); data/s3fs-fuse-1.87/src/s3fs_util.cpp:876:17: [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). mode = path[strlen(path) - 1] == '/' ? 0750 : 0640; data/s3fs-fuse-1.87/src/s3fs_util.cpp:897: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). }else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){ data/s3fs-fuse-1.87/src/s3fs_util.cpp:897:62: [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 && 0 < strlen(path) && '/' == path[strlen(path) - 1]){ data/s3fs-fuse-1.87/src/string_util.cpp:251: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). spos += strlen(keyword); data/s3fs-fuse-1.87/src/string_util.cpp:433:21: [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(!input || 0 == strlen(input) || !plength){ data/s3fs-fuse-1.87/src/string_util.cpp:436: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). result = new unsigned char[strlen(input) + 1]; data/s3fs-fuse-1.87/src/string_util.cpp:439: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). size_t input_len = strlen(input); data/s3fs-fuse-1.87/src/string_util.h:34:93: [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). static inline int STR2NCMP(const char *str1, const char *str2) { return strncmp(str1, str2, strlen(str2)); } ANALYSIS SUMMARY: Hits = 106 Lines analyzed = 20631 in approximately 0.55 seconds (37844 lines/second) Physical Source Lines of Code (SLOC) = 15422 Hits@level = [0] 37 [1] 34 [2] 52 [3] 17 [4] 3 [5] 0 Hits@level+ = [0+] 143 [1+] 106 [2+] 72 [3+] 20 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 9.27247 [1+] 6.8733 [2+] 4.66866 [3+] 1.29685 [4+] 0.194527 [5+] 0 Dot directories skipped = 2 (--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.