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/lua-compat53-0.7/c-api/compat-5.3.c
Examining data/lua-compat53-0.7/c-api/compat-5.3.h
Examining data/lua-compat53-0.7/lprefix.h
Examining data/lua-compat53-0.7/lstrlib.c
Examining data/lua-compat53-0.7/ltablib.c
Examining data/lua-compat53-0.7/lutf8lib.c
Examining data/lua-compat53-0.7/tests/testmod.c

FINAL RESULTS:

data/lua-compat53-0.7/lprefix.h:139:36:  [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 l_sprintf(s,sz,f,i) (snprintf(s, sz, f, i))
data/lua-compat53-0.7/lprefix.h:141:48:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
#      define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s, f, i))
data/lua-compat53-0.7/lstrlib.c:1010:3:  [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(form + l - 1, lenmod);
data/lua-compat53-0.7/tests/testmod.c:273:29:  [4] (shell) system:
  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.
  return luaL_execresult(L, system(cmd));
data/lua-compat53-0.7/tests/testmod.c:289:7:  [3] (tmpfile) tmpnam:
  Temporary file race condition (CWE-377).
  if (tmpnam(filename)) {
data/lua-compat53-0.7/c-api/compat-5.3.c:402: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 buf[512] = { 0 };
data/lua-compat53-0.7/c-api/compat-5.3.c:470: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 buff[COMPAT53_LUA_FILE_BUFFER_SIZE];  /* area for reading file */
data/lua-compat53-0.7/c-api/compat-5.3.c:493: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 buf[512] = {0};
data/lua-compat53-0.7/c-api/compat-5.3.c:567: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).
    lf.f = fopen(filename, "r"); /* default stdlib doesn't forcefully lock files here */
data/lua-compat53-0.7/c-api/compat-5.3.c:672: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(newptr, B->ptr, B->nelems);
data/lua-compat53-0.7/c-api/compat-5.3.c:683:3:  [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(luaL_prepbuffsize(B, l), s, l);
data/lua-compat53-0.7/lprefix.h:62: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 buff[8] = { 0 };
data/lua-compat53-0.7/lstrlib.c:135: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(p, s, l * sizeof(char)); p += l;
data/lua-compat53-0.7/lstrlib.c:137: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(p, sep, lsep * sizeof(char));
data/lua-compat53-0.7/lstrlib.c:141: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(p, s, l * sizeof(char));  /* last copy (not followed by separator) */
data/lua-compat53-0.7/lstrlib.c:916: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 buff[10];
data/lua-compat53-0.7/lstrlib.c:996:3:  [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(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char));
data/lua-compat53-0.7/lstrlib.c:1030: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 form[MAX_FORMAT];  /* to store the format ('%...') */
data/lua-compat53-0.7/lstrlib.c:1146: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 buff[5 * sizeof(lua_Number)];  /* enough for any float type */
data/lua-compat53-0.7/ltablib.c:263:3:  [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(buff, &c, sof(c) * sizeof(unsigned int));
data/lua-compat53-0.7/ltablib.c:264:3:  [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(buff + sof(c), &t, sof(t) * sizeof(unsigned int));
data/lua-compat53-0.7/tests/testmod.c:285: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 filename[L_tmpnam+1] = { 0 };
data/lua-compat53-0.7/tests/testmod.c:290:15:  [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* f = fopen(filename, "wb");
data/lua-compat53-0.7/c-api/compat-5.3.c:507:9:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    c = getc(lf->f);
data/lua-compat53-0.7/c-api/compat-5.3.c:512:10:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  return getc(lf->f);  /* return next character */
data/lua-compat53-0.7/c-api/compat-5.3.c:527:11:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      c = getc(lf->f);
data/lua-compat53-0.7/c-api/compat-5.3.c:529:11:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    *cp = getc(lf->f);  /* skip end-of-line, if present */
data/lua-compat53-0.7/c-api/compat-5.3.h:254: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).
  luaL_addlstring((B), (s), strlen((s)))
data/lua-compat53-0.7/lstrlib.c:585: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).
    upto += strlen(p + upto) + 1;  /* may have more after \0 */
data/lua-compat53-0.7/lstrlib.c:1007:14:  [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 l = strlen(form);
data/lua-compat53-0.7/lstrlib.c:1008: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).
  size_t lm = strlen(lenmod);
data/lua-compat53-0.7/lstrlib.c:1070:35:  [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).
            luaL_argcheck(L, l == strlen(s), arg, "string contains zeros");
data/lua-compat53-0.7/lstrlib.c:1400:26:  [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).
        luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros");
data/lua-compat53-0.7/lstrlib.c:1524: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).
        size_t len = (int)strlen(data + pos);

ANALYSIS SUMMARY:

Hits = 34
Lines analyzed = 4127 in approximately 0.13 seconds (32742 lines/second)
Physical Source Lines of Code (SLOC) = 3162
Hits@level = [0]   1 [1]  11 [2]  18 [3]   1 [4]   4 [5]   0
Hits@level+ = [0+]  35 [1+]  34 [2+]  23 [3+]   5 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 11.0689 [1+] 10.7527 [2+] 7.27388 [3+] 1.58128 [4+] 1.26502 [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.