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-systemfonts-0.3.2/src/font_registry.h Examining data/r-cran-systemfonts-0.3.2/src/font_matching.cpp Examining data/r-cran-systemfonts-0.3.2/src/dev_metrics.h Examining data/r-cran-systemfonts-0.3.2/src/win/FontManagerWindows.cpp Examining data/r-cran-systemfonts-0.3.2/src/win/DirectWriteFontManagerWindows.cpp Examining data/r-cran-systemfonts-0.3.2/src/unix/FontManagerLinux.cpp Examining data/r-cran-systemfonts-0.3.2/src/ft_cache.cpp Examining data/r-cran-systemfonts-0.3.2/src/font_matching.h Examining data/r-cran-systemfonts-0.3.2/src/dev_metrics.cpp Examining data/r-cran-systemfonts-0.3.2/src/init.cpp Examining data/r-cran-systemfonts-0.3.2/src/types.h Examining data/r-cran-systemfonts-0.3.2/src/caches.cpp Examining data/r-cran-systemfonts-0.3.2/src/cache_lru.h Examining data/r-cran-systemfonts-0.3.2/src/font_metrics.h Examining data/r-cran-systemfonts-0.3.2/src/utils.h Examining data/r-cran-systemfonts-0.3.2/src/cache_store.h Examining data/r-cran-systemfonts-0.3.2/src/font_registry.cpp Examining data/r-cran-systemfonts-0.3.2/src/caches.h Examining data/r-cran-systemfonts-0.3.2/src/font_metrics.cpp Examining data/r-cran-systemfonts-0.3.2/src/string_shape.cpp Examining data/r-cran-systemfonts-0.3.2/src/string_shape.h Examining data/r-cran-systemfonts-0.3.2/src/string_metrics.cpp Examining data/r-cran-systemfonts-0.3.2/src/emoji.cpp Examining data/r-cran-systemfonts-0.3.2/src/ft_cache.h Examining data/r-cran-systemfonts-0.3.2/src/emoji.h Examining data/r-cran-systemfonts-0.3.2/src/string_metrics.h Examining data/r-cran-systemfonts-0.3.2/src/FontDescriptor.h Examining data/r-cran-systemfonts-0.3.2/src/cache_store.cpp Examining data/r-cran-systemfonts-0.3.2/src/cpp11.cpp Examining data/r-cran-systemfonts-0.3.2/inst/include/systemfonts-ft.h Examining data/r-cran-systemfonts-0.3.2/inst/include/systemfonts.h FINAL RESULTS: data/r-cran-systemfonts-0.3.2/src/FontDescriptor.h:183:5: [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(str, input); data/r-cran-systemfonts-0.3.2/src/dev_metrics.cpp:38: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(gc.fontfamily, Rf_translateCharUTF8(family[0])); data/r-cran-systemfonts-0.3.2/src/dev_metrics.cpp:46: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(gc.fontfamily, Rf_translateCharUTF8(family[i])); data/r-cran-systemfonts-0.3.2/src/dev_metrics.cpp:86: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(gc.fontfamily, Rf_translateCharUTF8(family[0])); data/r-cran-systemfonts-0.3.2/src/dev_metrics.cpp:96: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(gc.fontfamily, Rf_translateCharUTF8(family[i])); data/r-cran-systemfonts-0.3.2/inst/include/systemfonts.h:14: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 feature[4]; data/r-cran-systemfonts-0.3.2/inst/include/systemfonts.h:19: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 file[PATH_MAX + 1]; data/r-cran-systemfonts-0.3.2/src/types.h:16: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 feature[4]; data/r-cran-systemfonts-0.3.2/src/types.h:26: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 file[PATH_MAX + 1]; data/r-cran-systemfonts-0.3.2/src/utils.h:22: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 buf[ERROR_SIZE] = ""; \ data/r-cran-systemfonts-0.3.2/src/utils.h:76: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. static const char trailingBytesForUTF8[256] = { data/r-cran-systemfonts-0.3.2/src/win/DirectWriteFontManagerWindows.cpp:12:22: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). unsigned int len = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0); data/r-cran-systemfonts-0.3.2/src/win/DirectWriteFontManagerWindows.cpp:14:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, input, -1, output, len); data/r-cran-systemfonts-0.3.2/src/win/DirectWriteFontManagerWindows.cpp:29:3: [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 localeName[LOCALE_NAME_MAX_LENGTH]; data/r-cran-systemfonts-0.3.2/src/win/FontManagerWindows.cpp:12:22: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). unsigned int len = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0); data/r-cran-systemfonts-0.3.2/src/win/FontManagerWindows.cpp:14:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, input, -1, output, len); data/r-cran-systemfonts-0.3.2/src/win/FontManagerWindows.cpp:60: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 win_dir[MAX_PATH]; data/r-cran-systemfonts-0.3.2/src/FontDescriptor.h:182: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). char *str = new char[strlen(input) + 1]; data/r-cran-systemfonts-0.3.2/src/font_matching.cpp:53:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path, font_it->second.file.c_str(), max_path_length); data/r-cran-systemfonts-0.3.2/src/font_matching.cpp:64:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path, CHAR(STRING_ELT(fallback[0], 0)), max_path_length); data/r-cran-systemfonts-0.3.2/src/font_matching.cpp:67:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path, font_loc->path, max_path_length); data/r-cran-systemfonts-0.3.2/src/font_matching.cpp:81:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path, registry_match.file, max_path_length); data/r-cran-systemfonts-0.3.2/src/font_registry.cpp:129:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(res.file, search->second.fonts[index].file.c_str(), PATH_MAX); data/r-cran-systemfonts-0.3.2/src/unix/FontManagerLinux.cpp:249:13: [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 len = strlen(string); data/r-cran-systemfonts-0.3.2/src/utils.h:30:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, e.what(), ERROR_SIZE - 1); \ data/r-cran-systemfonts-0.3.2/src/utils.h:33: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, "C++ error (unknown cause)", ERROR_SIZE - 1); \ data/r-cran-systemfonts-0.3.2/src/utils.h:44: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). unsigned int a_len = strlen(A); data/r-cran-systemfonts-0.3.2/src/utils.h:45:7: [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(B) != a_len) data/r-cran-systemfonts-0.3.2/src/utils.h:152: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). int n_bytes = strlen(string) + 1; data/r-cran-systemfonts-0.3.2/src/win/DirectWriteFontManagerWindows.cpp:457:5: [1] (buffer) wcslen: 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). wcslen(str), ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 4283 in approximately 0.12 seconds (35318 lines/second) Physical Source Lines of Code (SLOC) = 3539 Hits@level = [0] 0 [1] 13 [2] 12 [3] 0 [4] 5 [5] 0 Hits@level+ = [0+] 30 [1+] 30 [2+] 17 [3+] 5 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 8.47697 [1+] 8.47697 [2+] 4.80362 [3+] 1.41283 [4+] 1.41283 [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.