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-readr-1.4.0/src/localtime.h Examining data/r-cran-readr-1.4.0/src/type_convert.cpp Examining data/r-cran-readr-1.4.0/src/TokenizerLog.h Examining data/r-cran-readr-1.4.0/src/write_connection.h Examining data/r-cran-readr-1.4.0/src/localtime.c Examining data/r-cran-readr-1.4.0/src/write_delim.cpp Examining data/r-cran-readr-1.4.0/src/read.cpp Examining data/r-cran-readr-1.4.0/src/write_connection.cpp Examining data/r-cran-readr-1.4.0/src/Tokenizer.cpp Examining data/r-cran-readr-1.4.0/src/TokenizerDelim.h Examining data/r-cran-readr-1.4.0/src/Reader.cpp Examining data/r-cran-readr-1.4.0/src/Warnings.h Examining data/r-cran-readr-1.4.0/src/TokenizerWs.cpp Examining data/r-cran-readr-1.4.0/src/write.cpp Examining data/r-cran-readr-1.4.0/src/LocaleInfo.cpp Examining data/r-cran-readr-1.4.0/src/TokenizerFwf.h Examining data/r-cran-readr-1.4.0/src/SourceRaw.h Examining data/r-cran-readr-1.4.0/src/Reader.h Examining data/r-cran-readr-1.4.0/src/init.c Examining data/r-cran-readr-1.4.0/src/Source.cpp Examining data/r-cran-readr-1.4.0/src/TokenizerDelim.cpp Examining data/r-cran-readr-1.4.0/src/connection.h Examining data/r-cran-readr-1.4.0/src/TokenizerWs.h Examining data/r-cran-readr-1.4.0/src/Tokenizer.h Examining data/r-cran-readr-1.4.0/src/Progress.h Examining data/r-cran-readr-1.4.0/src/Source.h Examining data/r-cran-readr-1.4.0/src/Collector.cpp Examining data/r-cran-readr-1.4.0/src/utils.h Examining data/r-cran-readr-1.4.0/src/parse.cpp Examining data/r-cran-readr-1.4.0/src/Collector.h Examining data/r-cran-readr-1.4.0/src/DateTime.h Examining data/r-cran-readr-1.4.0/src/grisu3.h Examining data/r-cran-readr-1.4.0/src/grisu3.c Examining data/r-cran-readr-1.4.0/src/connection.cpp Examining data/r-cran-readr-1.4.0/src/TokenizerFwf.cpp Examining data/r-cran-readr-1.4.0/src/SourceFile.h Examining data/r-cran-readr-1.4.0/src/Iconv.h Examining data/r-cran-readr-1.4.0/src/CollectorGuess.cpp Examining data/r-cran-readr-1.4.0/src/datetime.cpp Examining data/r-cran-readr-1.4.0/src/LocaleInfo.h Examining data/r-cran-readr-1.4.0/src/SourceString.h Examining data/r-cran-readr-1.4.0/src/DateTimeParser.h Examining data/r-cran-readr-1.4.0/src/TokenizerLine.h Examining data/r-cran-readr-1.4.0/src/boost.h Examining data/r-cran-readr-1.4.0/src/QiParsers.h Examining data/r-cran-readr-1.4.0/src/cpp11.cpp Examining data/r-cran-readr-1.4.0/src/tzfile.h Examining data/r-cran-readr-1.4.0/src/Token.h Examining data/r-cran-readr-1.4.0/src/Iconv.cpp FINAL RESULTS: data/r-cran-readr-1.4.0/src/localtime.c:369:20: [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). (void) strcpy(fullname, p); data/r-cran-readr-1.4.0/src/localtime.c:371:20: [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). (void) strcat(fullname, name); data/r-cran-readr-1.4.0/src/localtime.c:378:25: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (doaccess && access(name, R_OK) != 0) { data/r-cran-readr-1.4.0/src/localtime.c:1165: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). (void) strcpy(lcl_TZname, name); data/r-cran-readr-1.4.0/src/localtime.c:1179: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). (void) strcpy(lclptr->chars, gmt); data/r-cran-readr-1.4.0/src/localtime.c:1193: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. tzset_name(getenv("TZ")); data/r-cran-readr-1.4.0/src/localtime.c:1815: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. const char* p = getenv("TZDIR"); data/r-cran-readr-1.4.0/src/localtime.c:1821:7: [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. p = getenv("R_SHARE_DIR"); data/r-cran-readr-1.4.0/src/localtime.c:1829:44: [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. snprintf(buf, 1000, "%s/share/zoneinfo", getenv("R_HOME")); data/r-cran-readr-1.4.0/src/Token.h:71: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(RAW(out), begin_, n); data/r-cran-readr-1.4.0/src/connection.h:13: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(buf, RAW(res), res.size()); data/r-cran-readr-1.4.0/src/connection.h:22: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(payload), buf, n); data/r-cran-readr-1.4.0/src/grisu3.c:351:49: [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. if ((u64 << 1) > 0xFFE0000000000000ULL) return sprintf(dst, "NaN(%08X%08X)", (uint32_t)(u64 >> 32), (uint32_t)u64); data/r-cran-readr-1.4.0/src/grisu3.c:361:23: [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. if (!success) return sprintf(s2, "%.17g", v) + (int)(s2 - dst); data/r-cran-readr-1.4.0/src/localtime.c:172:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char types[TZ_MAX_TIMES]; data/r-cran-readr-1.4.0/src/localtime.c:174: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 chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt), data/r-cran-readr-1.4.0/src/localtime.c:251:8: [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 lcl_TZname[TZ_STRLEN_MAX + 1]; data/r-cran-readr-1.4.0/src/localtime.c:332: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 buf[2 * sizeof(struct tzhead) + data/r-cran-readr-1.4.0/src/localtime.c:354: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 fullname[FILENAME_MAX + 1]; data/r-cran-readr-1.4.0/src/localtime.c:361:13: [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/r-cran-readr-1.4.0/src/localtime.c:382: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 ((fid = open(name, OPEN_MODE)) == -1) { data/r-cran-readr-1.4.0/src/tzfile.h:43: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 tzh_magic[4]; /* TZ_MAGIC */ data/r-cran-readr-1.4.0/src/tzfile.h:44: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 tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */ data/r-cran-readr-1.4.0/src/tzfile.h:45: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 tzh_reserved[15]; /* reserved--must be zero */ data/r-cran-readr-1.4.0/src/tzfile.h:46: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 tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ data/r-cran-readr-1.4.0/src/tzfile.h:47: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 tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ data/r-cran-readr-1.4.0/src/tzfile.h:48: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 tzh_leapcnt[4]; /* coded number of leap seconds */ data/r-cran-readr-1.4.0/src/tzfile.h:49: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 tzh_timecnt[4]; /* coded number of transition times */ data/r-cran-readr-1.4.0/src/tzfile.h:50: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 tzh_typecnt[4]; /* coded number of local time types */ data/r-cran-readr-1.4.0/src/tzfile.h:51: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 tzh_charcnt[4]; /* coded number of abbr. chars */ data/r-cran-readr-1.4.0/src/write_delim.cpp:230: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 str[32]; data/r-cran-readr-1.4.0/src/DateTimeParser.h:127: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). dateEnd_ = date + strlen(date); data/r-cran-readr-1.4.0/src/Reader.cpp:63:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int rows = read(lines); data/r-cran-readr-1.4.0/src/Reader.cpp:88:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int Reader::read(int lines) { data/r-cran-readr-1.4.0/src/Reader.h:28:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(lines); data/r-cran-readr-1.4.0/src/Reader.h:51:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read(int lines = -1); data/r-cran-readr-1.4.0/src/localtime.c:367: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 ((strlen(p) + strlen(name) + 1) >= sizeof fullname) data/r-cran-readr-1.4.0/src/localtime.c:367: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(p) + strlen(name) + 1) >= sizeof fullname) data/r-cran-readr-1.4.0/src/localtime.c:370: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. (void) strcat(fullname, "/"); data/r-cran-readr-1.4.0/src/localtime.c:388:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(fid, up->buf, sizeof up->buf); data/r-cran-readr-1.4.0/src/localtime.c:915: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). stdlen = strlen(name); /* length of standard zone name */ data/r-cran-readr-1.4.0/src/localtime.c:1127:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(cp, stdname, stdlen); data/r-cran-readr-1.4.0/src/localtime.c:1131:16: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(cp, dstname, dstlen); data/r-cran-readr-1.4.0/src/localtime.c:1163:16: [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). lcl_is_set = strlen(name) < sizeof lcl_TZname; data/r-cran-readr-1.4.0/src/localtime.c:1817:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, p, 999); data/r-cran-readr-1.4.0/src/localtime.c:1835:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(buf, "/usr/share/zoneinfo/", 1000); data/r-cran-readr-1.4.0/src/localtime.c:1841:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(buf, "/usr/share/lib/zoneinfo/", 1000); data/r-cran-readr-1.4.0/src/utils.h:30: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 true_len = strlen(true_values[i]); data/r-cran-readr-1.4.0/src/utils.h:41:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(false_values[i]) == len && ANALYSIS SUMMARY: Hits = 49 Lines analyzed = 7984 in approximately 0.23 seconds (34828 lines/second) Physical Source Lines of Code (SLOC) = 6151 Hits@level = [0] 2 [1] 18 [2] 22 [3] 4 [4] 5 [5] 0 Hits@level+ = [0+] 51 [1+] 49 [2+] 31 [3+] 9 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 8.29133 [1+] 7.96618 [2+] 5.03983 [3+] 1.46318 [4+] 0.812876 [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.