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-markdown-1.1+dfsg/src/houdini_html_e.c Examining data/r-cran-markdown-1.1+dfsg/src/markdown.h Examining data/r-cran-markdown-1.1+dfsg/src/stack.h Examining data/r-cran-markdown-1.1+dfsg/src/houdini.h Examining data/r-cran-markdown-1.1+dfsg/src/Rmarkdown.c Examining data/r-cran-markdown-1.1+dfsg/src/html.h Examining data/r-cran-markdown-1.1+dfsg/src/autolink.h Examining data/r-cran-markdown-1.1+dfsg/src/houdini_href_e.c Examining data/r-cran-markdown-1.1+dfsg/src/stack.c Examining data/r-cran-markdown-1.1+dfsg/src/markdown.c Examining data/r-cran-markdown-1.1+dfsg/src/html_blocks.h Examining data/r-cran-markdown-1.1+dfsg/src/html_smartypants.c Examining data/r-cran-markdown-1.1+dfsg/src/Rmarkdown.h Examining data/r-cran-markdown-1.1+dfsg/src/html.c Examining data/r-cran-markdown-1.1+dfsg/src/sundown_version.h Examining data/r-cran-markdown-1.1+dfsg/src/buffer.h Examining data/r-cran-markdown-1.1+dfsg/src/buffer.c Examining data/r-cran-markdown-1.1+dfsg/src/autolink.c Examining data/r-cran-markdown-1.1+dfsg/src/Rinit.c Examining data/r-cran-markdown-1.1+dfsg/src/Rbase64.c Examining data/r-cran-markdown-1.1+dfsg/inst/include/markdown.h Examining data/r-cran-markdown-1.1+dfsg/inst/include/markdown_rstubs.h Examining data/r-cran-markdown-1.1+dfsg/inst/include/autolink.h Examining data/r-cran-markdown-1.1+dfsg/inst/include/buffer.h Examining data/r-cran-markdown-1.1+dfsg/inst/include/markdown_rstubs.c FINAL RESULTS: data/r-cran-markdown-1.1+dfsg/inst/include/buffer.h:90:73: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. void bufprintf(struct buf *, const char *, ...) __attribute__ ((format (printf, 2, 3))); data/r-cran-markdown-1.1+dfsg/inst/include/markdown_rstubs.h:66:79: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. void rstub_bufprintf(struct buf *, const char *, ...) __attribute__ ((format (printf, 2, 3))); data/r-cran-markdown-1.1+dfsg/src/buffer.c:31:25: [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. # define _buf_vsnprintf vsnprintf data/r-cran-markdown-1.1+dfsg/src/buffer.h:85:73: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. void bufprintf(struct buf *, const char *, ...) __attribute__ ((format (printf, 2, 3))); data/r-cran-markdown-1.1+dfsg/src/html_smartypants.c:26:9: [4] (format) snprintf: 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. #define snprintf _snprintf data/r-cran-markdown-1.1+dfsg/src/html_smartypants.c:26:18: [4] (format) _snprintf: 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. #define snprintf _snprintf data/r-cran-markdown-1.1+dfsg/src/Rbase64.c:15:28: [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. void encodeblock( unsigned char in[3], unsigned char out[4], int len ) data/r-cran-markdown-1.1+dfsg/src/Rbase64.c:15:49: [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. void encodeblock( unsigned char in[3], unsigned char out[4], int len ) data/r-cran-markdown-1.1+dfsg/src/Rbase64.c:25: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. unsigned char in[3], out[4]; data/r-cran-markdown-1.1+dfsg/src/Rmarkdown.c:311:12: [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). in = fopen(file,"r"); data/r-cran-markdown-1.1+dfsg/src/Rmarkdown.c:335: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(*raw_vec),ob->data,ob->size); data/r-cran-markdown-1.1+dfsg/src/Rmarkdown.c:341:19: [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 *out = fopen(filename,"w"); data/r-cran-markdown-1.1+dfsg/src/autolink.c:42:17: [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. strncasecmp((char *)link, valid_uris[i], len) == 0 && data/r-cran-markdown-1.1+dfsg/src/buffer.c:159:2: [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->data + buf->size, data, len); data/r-cran-markdown-1.1+dfsg/src/houdini_href_e.c:58:2: [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 hex_str[3]; data/r-cran-markdown-1.1+dfsg/src/html.c:606:2: [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(callbacks, &cb_default, sizeof(struct sd_callbacks)); data/r-cran-markdown-1.1+dfsg/src/html.c:651:2: [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(callbacks, &cb_default, sizeof(struct sd_callbacks)); data/r-cran-markdown-1.1+dfsg/src/html_blocks.h:36:17: [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 unsigned char gperf_downcase[256] = data/r-cran-markdown-1.1+dfsg/src/html_smartypants.c:89:2: [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 ent[8]; data/r-cran-markdown-1.1+dfsg/src/markdown.c:2660:2: [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(&md->cb, callbacks, sizeof(struct sd_callbacks)); data/r-cran-markdown-1.1+dfsg/inst/include/buffer.h:53: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). { (uint8_t *)strname, strlen(strname), 0, 0, 0 } data/r-cran-markdown-1.1+dfsg/src/Rmarkdown.c:293: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). len = strlen(text); data/r-cran-markdown-1.1+dfsg/src/autolink.c:39: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). size_t len = strlen(valid_uris[i]); data/r-cran-markdown-1.1+dfsg/src/autolink.c:160:39: [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 (size < 4 || memcmp(data, "www.", strlen("www.")) != 0) data/r-cran-markdown-1.1+dfsg/src/autolink.c:244: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). link_end = strlen("://"); data/r-cran-markdown-1.1+dfsg/src/buffer.c:167: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). bufput(buf, str, strlen(str)); data/r-cran-markdown-1.1+dfsg/src/buffer.h:48: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). { (uint8_t *)strname, strlen(strname), 0, 0, 0 } data/r-cran-markdown-1.1+dfsg/src/markdown.c:2110: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). size_t tag_size = strlen(curtag); ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 6601 in approximately 0.19 seconds (34377 lines/second) Physical Source Lines of Code (SLOC) = 4636 Hits@level = [0] 2 [1] 8 [2] 14 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 30 [1+] 28 [2+] 20 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 6.4711 [1+] 6.03969 [2+] 4.31406 [3+] 1.29422 [4+] 1.29422 [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.