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-curl-4.3+dfsg/src/interrupt.c Examining data/r-cran-curl-4.3+dfsg/src/version.c Examining data/r-cran-curl-4.3+dfsg/src/multi.c Examining data/r-cran-curl-4.3+dfsg/src/form.c Examining data/r-cran-curl-4.3+dfsg/src/typechecking.c Examining data/r-cran-curl-4.3+dfsg/src/init.c Examining data/r-cran-curl-4.3+dfsg/src/utils.c Examining data/r-cran-curl-4.3+dfsg/src/curl-symbols.h Examining data/r-cran-curl-4.3+dfsg/src/curl-common.h Examining data/r-cran-curl-4.3+dfsg/src/reflist.c Examining data/r-cran-curl-4.3+dfsg/src/curl.c Examining data/r-cran-curl-4.3+dfsg/src/callbacks.c Examining data/r-cran-curl-4.3+dfsg/src/ieproxy.c Examining data/r-cran-curl-4.3+dfsg/src/escape.c Examining data/r-cran-curl-4.3+dfsg/src/writer.c Examining data/r-cran-curl-4.3+dfsg/src/ssl.c Examining data/r-cran-curl-4.3+dfsg/src/winidn.c Examining data/r-cran-curl-4.3+dfsg/src/download.c Examining data/r-cran-curl-4.3+dfsg/src/getdate.c Examining data/r-cran-curl-4.3+dfsg/src/handle.c Examining data/r-cran-curl-4.3+dfsg/src/fetch.c Examining data/r-cran-curl-4.3+dfsg/src/nslookup.c Examining data/r-cran-curl-4.3+dfsg/src/callbacks.h Examining data/r-cran-curl-4.3+dfsg/src/split.c FINAL RESULTS: data/r-cran-curl-4.3+dfsg/src/curl.c:266:3: [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(req->url, translateCharUTF8(asChar(url))); data/r-cran-curl-4.3+dfsg/src/handle.c:32:3: [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(R_WINDOWS_CA_BUNDLE, CHAR(asChar(path))); data/r-cran-curl-4.3+dfsg/src/handle.c:140:31: [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 *ca_bundle = getenv("CURL_CA_BUNDLE"); data/r-cran-curl-4.3+dfsg/src/ssl.c:14:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *envvar = getenv("CURL_SSL_BACKEND"); data/r-cran-curl-4.3+dfsg/src/callbacks.c:54: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(buffer, RAW(res), bytes_read); data/r-cran-curl-4.3+dfsg/src/callbacks.c:66: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(RAW(msg), data, size); data/r-cran-curl-4.3+dfsg/src/curl-common.h:37: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 errbuf[CURL_ERROR_SIZE]; data/r-cran-curl-4.3+dfsg/src/curl.c:82: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(req->buf + req->size, contents, realsize); data/r-cran-curl-4.3+dfsg/src/curl.c:90: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(target, req->cur, copy_size); data/r-cran-curl-4.3+dfsg/src/download.c:24:16: [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). FILE *dest = fopen(CHAR(asChar(destfile)), CHAR(asChar(mode))); data/r-cran-curl-4.3+dfsg/src/fetch.c:46: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(RAW(out), body.buf, body.size); data/r-cran-curl-4.3+dfsg/src/fetch.c:71:16: [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). FILE *dest = fopen(CHAR(asChar(path)), CHAR(asChar(mode))); data/r-cran-curl-4.3+dfsg/src/handle.c:29:1: [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 R_WINDOWS_CA_BUNDLE[MAX_PATH]; data/r-cran-curl-4.3+dfsg/src/handle.c:445: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(RAW(out), ptr, size); data/r-cran-curl-4.3+dfsg/src/ieproxy.c:39: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 buffer[500]; data/r-cran-curl-4.3+dfsg/src/ieproxy.c:128:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[500]; data/r-cran-curl-4.3+dfsg/src/multi.c:131:11: [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(RAW(buf), ref->async.content.buf, ref->async.content.size); data/r-cran-curl-4.3+dfsg/src/nslookup.c:59: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 ip[INET6_ADDRSTRLEN]; data/r-cran-curl-4.3+dfsg/src/utils.c:46:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[8000] = {0}; data/r-cran-curl-4.3+dfsg/src/utils.c:158: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(&(mem->buf[mem->size]), contents, realsize); data/r-cran-curl-4.3+dfsg/src/utils.c:166: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(RAW(buf), data, size); data/r-cran-curl-4.3+dfsg/src/winidn.c:13:21: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int str_w_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, data/r-cran-curl-4.3+dfsg/src/winidn.c:18:12: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). if(MultiByteToWideChar(CP_UTF8, 0, str_utf8, -1, str_w, data/r-cran-curl-4.3+dfsg/src/winidn.c:55:5: [2] (buffer) wchar_t: 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. wchar_t punycode[IDN_MAX_LENGTH]; data/r-cran-curl-4.3+dfsg/src/writer.c:18:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(CHAR(STRING_ELT(path, 0)), "wb"); data/r-cran-curl-4.3+dfsg/src/curl.c:186:3: [1] (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 character. strcpy(con->mode, "r"); data/r-cran-curl-4.3+dfsg/src/curl.c:265: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). req->url = malloc(strlen(translateCharUTF8(asChar(url))) + 1); data/r-cran-curl-4.3+dfsg/src/handle.c:143: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). } else if( R_WINDOWS_CA_BUNDLE != NULL && strlen(R_WINDOWS_CA_BUNDLE)){ data/r-cran-curl-4.3+dfsg/src/multi.c:161: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). SEXP buf = PROTECT(mkString(strlen(ref->errbuf) ? ref->errbuf : curl_easy_strerror(status))); data/r-cran-curl-4.3+dfsg/src/split.c:13: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). SET_STRING_ELT(res, 1, mkCharCE(out + strlen(cut), enc)); data/r-cran-curl-4.3+dfsg/src/utils.c:48:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(url, input, 7999); data/r-cran-curl-4.3+dfsg/src/utils.c:73: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). Rf_error("%s", strlen(ref->errbuf) ? ref->errbuf : curl_easy_strerror(res)); ANALYSIS SUMMARY: Hits = 32 Lines analyzed = 3257 in approximately 0.12 seconds (27552 lines/second) Physical Source Lines of Code (SLOC) = 2674 Hits@level = [0] 0 [1] 7 [2] 21 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 32 [1+] 32 [2+] 25 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 11.9671 [1+] 11.9671 [2+] 9.34929 [3+] 1.49589 [4+] 0.747943 [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.