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-filehash-2.4-2/src/sha1.h
Examining data/r-cran-filehash-2.4-2/src/hash.c
Examining data/r-cran-filehash-2.4-2/src/sha1.c
Examining data/r-cran-filehash-2.4-2/src/lockfile.c
Examining data/r-cran-filehash-2.4-2/src/init.c
Examining data/r-cran-filehash-2.4-2/src/readKeyMap.c

FINAL RESULTS:

data/r-cran-filehash-2.4-2/src/hash.c:13: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 output[41];  /* SHA-1 is 40 bytes + '\0' */
data/r-cran-filehash-2.4-2/src/hash.c:17:11:  [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 buffer[20];
data/r-cran-filehash-2.4-2/src/hash.c:39:3:  [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.
		sprintf(output + i * 2, "%02x", buffer[i]);
data/r-cran-filehash-2.4-2/src/hash.c:51: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 output[41];  /* SHA-1 is 40 bytes + '\0' */
data/r-cran-filehash-2.4-2/src/hash.c:56:11:  [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 buf[1024];
data/r-cran-filehash-2.4-2/src/hash.c:57:11:  [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 sha1sum[20];
data/r-cran-filehash-2.4-2/src/hash.c:64: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).
	if(!(fp = fopen(CHAR(STRING_ELT(filename, 0)), "rb"))) 
data/r-cran-filehash-2.4-2/src/hash.c:77:3:  [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.
		sprintf(output + i * 2, "%02x", sha1sum[i]);
data/r-cran-filehash-2.4-2/src/lockfile.c:15:7:  [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).
	fd = open(CHAR(STRING_ELT(filename, 0)),
data/r-cran-filehash-2.4-2/src/readKeyMap.c:21:14:  [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(filename, 0)), "rb");
data/r-cran-filehash-2.4-2/src/sha1.c:212:9:  [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( (void *) (ctx->buffer + left),
data/r-cran-filehash-2.4-2/src/sha1.c:229:9:  [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( (void *) (ctx->buffer + left),
data/r-cran-filehash-2.4-2/src/sha1.c:295: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 output[41];
data/r-cran-filehash-2.4-2/src/sha1.c:297: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 buf[1000];
data/r-cran-filehash-2.4-2/src/sha1.c:298: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 sha1sum[20];
data/r-cran-filehash-2.4-2/src/sha1.c:329:17:  [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.
                sprintf( output + j * 2, "%02x", sha1sum[j] );
data/r-cran-filehash-2.4-2/src/sha1.c:345:21:  [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).
        if( ! ( f = fopen( argv[1], "rb" ) ) )
data/r-cran-filehash-2.4-2/src/sha1.c:313: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).
                             strlen( msg[i] ) );

ANALYSIS SUMMARY:

Hits = 18
Lines analyzed = 591 in approximately 0.03 seconds (20252 lines/second)
Physical Source Lines of Code (SLOC) = 467
Hits@level = [0]   9 [1]   1 [2]  17 [3]   0 [4]   0 [5]   0
Hits@level+ = [0+]  27 [1+]  18 [2+]  17 [3+]   0 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 57.8158 [1+] 38.5439 [2+] 36.4026 [3+]   0 [4+]   0 [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.