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-cjson-2.1.0+dfsg/dtoa.c Examining data/lua-cjson-2.1.0+dfsg/dtoa_config.h Examining data/lua-cjson-2.1.0+dfsg/fpconv.c Examining data/lua-cjson-2.1.0+dfsg/fpconv.h Examining data/lua-cjson-2.1.0+dfsg/g_fmt.c Examining data/lua-cjson-2.1.0+dfsg/lua_cjson.c Examining data/lua-cjson-2.1.0+dfsg/strbuf.c Examining data/lua-cjson-2.1.0+dfsg/strbuf.h FINAL RESULTS: data/lua-cjson-2.1.0+dfsg/dtoa.c:1787:4: [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((char*)decimalpoint_cache, (CONST char*)s0); data/lua-cjson-2.1.0+dfsg/fpconv.c:185:16: [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. return snprintf(str, FPCONV_G_FMT_BUFSIZE, fmt, num); data/lua-cjson-2.1.0+dfsg/fpconv.c:188:11: [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. len = snprintf(buf, FPCONV_G_FMT_BUFSIZE, fmt, num); data/lua-cjson-2.1.0+dfsg/strbuf.c:37:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, arg); data/lua-cjson-2.1.0+dfsg/strbuf.c:210:15: [4] (format) vsnprintf: 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. fmt_len = vsnprintf(s->buf + s->length, len, fmt, arg); data/lua-cjson-2.1.0+dfsg/strbuf.c:236:19: [4] (format) vsnprintf: 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. fmt_len = vsnprintf(s->buf + s->length, empty_len + 1, fmt, arg); data/lua-cjson-2.1.0+dfsg/dtoa.c:609:20: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ data/lua-cjson-2.1.0+dfsg/dtoa.c:1500: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. static unsigned char hexdig[256]; data/lua-cjson-2.1.0+dfsg/fpconv.c:54: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 buf[8]; data/lua-cjson-2.1.0+dfsg/fpconv.c:108: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 localbuf[FPCONV_G_FMT_BUFSIZE]; data/lua-cjson-2.1.0+dfsg/fpconv.c:136: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(buf, nptr, buflen); data/lua-cjson-2.1.0+dfsg/fpconv.c:176: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 buf[FPCONV_G_FMT_BUFSIZE]; data/lua-cjson-2.1.0+dfsg/fpconv.c:177: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 fmt[6]; data/lua-cjson-2.1.0+dfsg/lua_cjson.c:114: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 escape2char[256]; /* Decoding */ data/lua-cjson-2.1.0+dfsg/lua_cjson.c:151: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. static const char *char2escape[256] = { data/lua-cjson-2.1.0+dfsg/lua_cjson.c:221: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 errmsg[64]; data/lua-cjson-2.1.0+dfsg/lua_cjson.c:819: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 utf8[4]; /* Surrogate pairs require 4 UTF-8 bytes */ data/lua-cjson-2.1.0+dfsg/strbuf.h:130: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(s->buf + s->length, c, len); data/lua-cjson-2.1.0+dfsg/strbuf.h:136: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(s->buf + s->length, c, len); data/lua-cjson-2.1.0+dfsg/dtoa.c:1786:12: [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). MALLOC(strlen((CONST char*)s0) + 1))) { ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 6600 in approximately 0.15 seconds (43746 lines/second) Physical Source Lines of Code (SLOC) = 5207 Hits@level = [0] 11 [1] 1 [2] 13 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 31 [1+] 20 [2+] 19 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 5.95352 [1+] 3.84098 [2+] 3.64893 [3+] 1.15229 [4+] 1.15229 [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.