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/elfrc-0.7/elfrc.c

FINAL RESULTS:

data/elfrc-0.7/elfrc.c:842:5:  [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.
    printf( ELFRC_COPYRIGHT "\n" );
data/elfrc-0.7/elfrc.c:799:5:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    srand( time( NULL ) );
data/elfrc-0.7/elfrc.c:865:26:  [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.
    } else if ( ( path = getenv( "PATH" ) ) != NULL ) {
data/elfrc-0.7/elfrc.c:889:20:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ( ( ch = getopt( argc, argv, "o:h:v?" ) ) != -1 ) {
data/elfrc-0.7/elfrc.c:335: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 buffer[ 8192 ];
data/elfrc-0.7/elfrc.c:341:17:  [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 ( ( fd = open( src, O_RDONLY ) ) == -1 ) {
data/elfrc-0.7/elfrc.c:431:17:  [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 ( ( fd = open( pathToSelf, O_RDONLY ) ) == -1 ) {
data/elfrc-0.7/elfrc.c:526:17:  [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 ( ( fd = open( fn, O_WRONLY | O_CREAT | O_TRUNC, 0644) ) == -1 ) {
data/elfrc-0.7/elfrc.c:623: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 curType[ 32 ];
data/elfrc-0.7/elfrc.c:625: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 curSymbol[ 256 ];
data/elfrc-0.7/elfrc.c:627: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 curFilename[ PATH_MAX ];
data/elfrc-0.7/elfrc.c:748: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 buffer[ 1024 ];
data/elfrc-0.7/elfrc.c:756:24:  [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).
    } else if ( ( fd = open( fn, O_RDONLY ) ) == -1 ) {
data/elfrc-0.7/elfrc.c:783: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 includeGuard[ 19 ];
data/elfrc-0.7/elfrc.c:792:17:  [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 ( ( fd = fopen( fn, "w+" ) ) == NULL ) {
data/elfrc-0.7/elfrc.c:848: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 self[ PATH_MAX ];
data/elfrc-0.7/elfrc.c:347:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if ( ( nread = read( fd, buffer,sizeof( buffer ) ) ) == -1 ) {
data/elfrc-0.7/elfrc.c:435:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if ( read( fd, &ownhdr, sizeof( ownhdr ) ) == -1 ) {
data/elfrc-0.7/elfrc.c:587: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).
    res->symbolSize = strlen( res->symbol ) + 1;
data/elfrc-0.7/elfrc.c:671:21:  [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( curType, "binary", sizeof( curType ) );
data/elfrc-0.7/elfrc.c:762:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if ( ( nread = read( fd, buffer, sizeof( buffer ) ) ) == -1 ) {
data/elfrc-0.7/elfrc.c:854:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy( self, invocation, sizeof( self ) );
data/elfrc-0.7/elfrc.c:860:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant character.
        strncat( self, "/", sizeof( self ) - strlen( self ) - 1 );
data/elfrc-0.7/elfrc.c:860:46:  [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).
        strncat( self, "/", sizeof( self ) - strlen( self ) - 1 );
data/elfrc-0.7/elfrc.c:861:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
        strncat( self, invocation, sizeof( self ) - strlen( self ) - 1 );
data/elfrc-0.7/elfrc.c:861:53:  [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).
        strncat( self, invocation, sizeof( self ) - strlen( self ) - 1 );

ANALYSIS SUMMARY:

Hits = 26
Lines analyzed = 938 in approximately 0.07 seconds (13630 lines/second)
Physical Source Lines of Code (SLOC) = 751
Hits@level = [0]  37 [1]  10 [2]  12 [3]   3 [4]   1 [5]   0
Hits@level+ = [0+]  63 [1+]  26 [2+]  16 [3+]   4 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 83.8881 [1+] 34.6205 [2+] 21.3049 [3+] 5.32623 [4+] 1.33156 [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.