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/hexec-0.2.1/common/args.c
Examining data/hexec-0.2.1/common/error.h
Examining data/hexec-0.2.1/common/buf.h
Examining data/hexec-0.2.1/common/expr.h
Examining data/hexec-0.2.1/common/utils.h
Examining data/hexec-0.2.1/common/locate.h
Examining data/hexec-0.2.1/common/utils.c
Examining data/hexec-0.2.1/common/shm.h
Examining data/hexec-0.2.1/common/error.c
Examining data/hexec-0.2.1/common/args.h
Examining data/hexec-0.2.1/common/locate.c
Examining data/hexec-0.2.1/common/shm.c
Examining data/hexec-0.2.1/common/buf.c
Examining data/hexec-0.2.1/hook/expr-eval-exec.c
Examining data/hexec-0.2.1/hook/libhexec-hook.c
Examining data/hexec-0.2.1/hook/libhexec-hook.h
Examining data/hexec-0.2.1/hook/expr-eval.c
Examining data/hexec-0.2.1/hexec/hexec.h
Examining data/hexec-0.2.1/hexec/hexec.c
Examining data/hexec-0.2.1/hexec/hexec-expr-grammar.c
Examining data/hexec-0.2.1/hexec/parser.c
Examining data/hexec-0.2.1/hexec/parser.h

FINAL RESULTS:

data/hexec-0.2.1/common/buf.c:84: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(buf->buf + ptr, str);
data/hexec-0.2.1/common/locate.c:44:12:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    return access(path, X_OK);
data/hexec-0.2.1/hexec/hexec-expr-grammar.c:641: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/hexec-0.2.1/hexec/hexec.c:72:9:  [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(new_value, orig_value);
data/hexec-0.2.1/hexec/hexec.c:74:9:  [4] (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).
        strcat(new_value, value);
data/hexec-0.2.1/hexec/hexec.c:233:19:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
        int err = execvp(args.argv[parser.cur_arg], args.argv + parser.cur_arg);
data/hexec-0.2.1/hexec/parser.c:106: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(str2, str);
data/hexec-0.2.1/hexec/parser.c:154:9:  [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(p->buf->buf + argv1[i], p->args->argv[i + p->cur_arg]);
data/hexec-0.2.1/hook/libhexec-hook.c:76:14:  [4] (shell) execl:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    LOADFUNC(execl);
data/hexec-0.2.1/hook/libhexec-hook.c:77:14:  [4] (shell) execlp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    LOADFUNC(execlp);
data/hexec-0.2.1/hook/libhexec-hook.c:78:14:  [4] (shell) execle:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    LOADFUNC(execle);
data/hexec-0.2.1/hook/libhexec-hook.c:79:14:  [4] (shell) execv:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    LOADFUNC(execv);
data/hexec-0.2.1/hook/libhexec-hook.c:80:14:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    LOADFUNC(execvp);
data/hexec-0.2.1/hook/libhexec-hook.c:189:5:  [4] (shell) execl:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
int execl(const char *path, const char *arg, ...)
data/hexec-0.2.1/hook/libhexec-hook.c:207:5:  [4] (shell) execlp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
int execlp(const char *file, const char *arg, ...)
data/hexec-0.2.1/hook/libhexec-hook.c:225:5:  [4] (shell) execle:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
int execle(const char *path, const char *arg, ...)
data/hexec-0.2.1/hook/libhexec-hook.c:243:5:  [4] (shell) execv:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
int execv(const char *path, char *const argv[])
data/hexec-0.2.1/hook/libhexec-hook.c:258:5:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
int execvp(const char *file, char *const argv[])
data/hexec-0.2.1/common/locate.c:64:18:  [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.
    char *path = getenv ("PATH");
data/hexec-0.2.1/hexec/hexec.c:64:24:  [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.
    char* orig_value = getenv(var);
data/hexec-0.2.1/hook/libhexec-hook.c:82:22:  [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.
    char* shm_name = getenv("HEXEC_EXPR_SHM");
data/hexec-0.2.1/hook/libhexec-hook.c:96:28:  [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.
    char* log_out_fd_str = getenv("HEXEC_LOG_FD");
data/hexec-0.2.1/common/buf.c:77:5:  [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(to, buf->buf, size);
data/hexec-0.2.1/common/error.c:51:18:  [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).
    log_out_fd = open(path, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
data/hexec-0.2.1/common/locate.c:91: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(path, DEFAULT_PATH, pathlen + 1);
data/hexec-0.2.1/common/locate.c:95:21:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    name = (char *) memcpy (name + pathlen + 1, file, len);
data/hexec-0.2.1/common/locate.c:116:31:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            startp = (char *) memcpy (name - (p - path), path, p - path);
data/hexec-0.2.1/common/shm.c:73:5:  [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(mmap_buf, &header, sizeof(struct shm_header));
data/hexec-0.2.1/common/shm.c:104:5:  [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(&header, mmap_buf, sizeof(struct shm_header));
data/hexec-0.2.1/common/utils.c:43:5:  [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(s1 + *cur_len, s2, s2_len + 1);
data/hexec-0.2.1/common/utils.c:50: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 tmp[2] = {ch, 0};
data/hexec-0.2.1/hexec/hexec-expr-grammar.c:938: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/hexec-0.2.1/hexec/hexec-expr-grammar.c:955: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/hexec-0.2.1/hexec/hexec-expr-grammar.c:1123: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/hexec-0.2.1/hexec/hexec.c:122:5:  [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(name, "/hexec-shm-%d", getpid());
data/hexec-0.2.1/hexec/hexec.c:127: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 shm_name[128];
data/hexec-0.2.1/hexec/hexec.c:137: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 shm_name[128];
data/hexec-0.2.1/hexec/hexec.c:228:9:  [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 tmp[16];
data/hexec-0.2.1/hexec/hexec.c:229:9:  [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(tmp, "%d", log_out_fd);
data/hexec-0.2.1/hook/expr-eval-exec.c:133:37:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
                        first_arg = atoi(arg + i);
data/hexec-0.2.1/hook/expr-eval-exec.c:155: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.
                char tmp[32];
data/hexec-0.2.1/hook/expr-eval-exec.c:156: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(tmp, "%d", orig_args->argc);
data/hexec-0.2.1/hook/libhexec-hook.c:98:22:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        log_out_fd = atoi(log_out_fd_str);
data/hexec-0.2.1/common/buf.c:83:36:  [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 ptr = hexec_buf_alloc(buf, strlen(str) + 1);
data/hexec-0.2.1/common/locate.c:67: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).
        pathlen = strlen(DEFAULT_PATH);
data/hexec-0.2.1/common/locate.c:72: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).
        pathlen = strlen (path);
data/hexec-0.2.1/common/locate.c:75:18:  [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 (file) + 1;
data/hexec-0.2.1/common/utils.c:31:18:  [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 s2_len = strlen(s2);
data/hexec-0.2.1/hexec/hexec-expr-grammar.c:819: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/hexec-0.2.1/hexec/hexec.c:71:34:  [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* new_value = malloc(strlen(orig_value) + strlen(value) + 2);
data/hexec-0.2.1/hexec/hexec.c:71:55:  [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* new_value = malloc(strlen(orig_value) + strlen(value) + 2);
data/hexec-0.2.1/hexec/hexec.c:73:9:  [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(new_value, " ");
data/hexec-0.2.1/hexec/hexec.c:84:22:  [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 arg_len = strlen(argv[*cur_arg]);
data/hexec-0.2.1/hexec/hexec.c:85: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).
    size_t name_len = strlen(name);
data/hexec-0.2.1/hexec/parser.c:103:38:  [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).
    e->str = hexec_buf_alloc(p->buf, strlen(str) + 1);
data/hexec-0.2.1/hexec/parser.c:153:44:  [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).
        argv1[i] = hexec_buf_alloc(p->buf, strlen(p->args->argv[i + p->cur_arg]) + 1);
data/hexec-0.2.1/hook/expr-eval-exec.c:51:27:  [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(HEXEC_LIBHOOK);
data/hexec-0.2.1/hook/expr-eval-exec.c:55:75:  [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).
                    memmove(env->argv[i] + pos, env->argv[i] + pos + len, strlen(env->argv[i]) - pos - len + 1); 
data/hexec-0.2.1/hook/expr-eval-exec.c:82: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 arg_len = strlen(arg);

ANALYSIS SUMMARY:

Hits = 59
Lines analyzed = 3884 in approximately 0.14 seconds (28507 lines/second)
Physical Source Lines of Code (SLOC) = 2587
Hits@level = [0]   9 [1]  16 [2]  21 [3]   4 [4]  18 [5]   0
Hits@level+ = [0+]  68 [1+]  59 [2+]  43 [3+]  22 [4+]  18 [5+]   0
Hits/KSLOC@level+ = [0+] 26.2853 [1+] 22.8063 [2+] 16.6216 [3+] 8.50406 [4+] 6.95787 [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.