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-bibtex-0.4.2.3/src/biblex.c Examining data/r-cran-bibtex-0.4.2.3/src/init.c Examining data/r-cran-bibtex-0.4.2.3/src/stretchyList.c Examining data/r-cran-bibtex-0.4.2.3/src/bibparse.c Examining data/r-cran-bibtex-0.4.2.3/inst/include/bibparse.h Examining data/r-cran-bibtex-0.4.2.3/inst/include/bibtex.h FINAL RESULTS: data/r-cran-bibtex-0.4.2.3/src/bibparse.c:877:21: [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. # define YYFPRINTF fprintf data/r-cran-bibtex-0.4.2.3/src/biblex.c:540: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 yytext[YYLMAX]; data/r-cran-bibtex-0.4.2.3/src/biblex.c:2229: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 octal[4 + 1]; data/r-cran-bibtex-0.4.2.3/src/biblex.c:2276:12: [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. (void)sprintf(octal,"\\%03o",BYTE_VAL(*token)); data/r-cran-bibtex-0.4.2.3/src/bibparse.c:1180: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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; data/r-cran-bibtex-0.4.2.3/src/bibparse.c:1197: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 yyformat[sizeof yyunexpected data/r-cran-bibtex-0.4.2.3/src/bibparse.c:2804: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 yymsgbuf[128]; data/r-cran-bibtex-0.4.2.3/src/bibparse.c:3580: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. static char fixedmode[6]; data/r-cran-bibtex-0.4.2.3/src/bibparse.c:3594:23: [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). return(filename ? fopen(filename, fixmode(mode)) : NULL ); data/r-cran-bibtex-0.4.2.3/src/bibparse.c:4050: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 res[n] ; data/r-cran-bibtex-0.4.2.3/src/bibparse.c:4192: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 noquote[n-2] ; data/r-cran-bibtex-0.4.2.3/src/biblex.c:720:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/r-cran-bibtex-0.4.2.3/src/biblex.c:1757:29: [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). return yy_scan_bytes(yystr,strlen(yystr) ); data/r-cran-bibtex-0.4.2.3/src/biblex.c:2374: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). n = strlen((const char*)&yytext[0]); data/r-cran-bibtex-0.4.2.3/src/biblex.c:2442: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). setToken( token, strlen(token) ); data/r-cran-bibtex-0.4.2.3/src/bibparse.c:1061: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). # define yystrlen strlen data/r-cran-bibtex-0.4.2.3/src/bibparse.c:3582:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fixedmode, mode, 4); data/r-cran-bibtex-0.4.2.3/src/bibparse.c:3584:3: [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. strcat(fixedmode, "t"); data/r-cran-bibtex-0.4.2.3/src/bibparse.c:4047: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). int n_left = strlen( left_); data/r-cran-bibtex-0.4.2.3/src/bibparse.c:4048: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). int n_right = strlen( right_); data/r-cran-bibtex-0.4.2.3/src/bibparse.c:4183: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). int n = strlen(data); ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 7186 in approximately 0.19 seconds (37423 lines/second) Physical Source Lines of Code (SLOC) = 4418 Hits@level = [0] 4 [1] 10 [2] 10 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 25 [1+] 21 [2+] 11 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 5.65867 [1+] 4.75328 [2+] 2.48981 [3+] 0.226347 [4+] 0.226347 [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.