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-discount-2.1.8/css.c Examining data/lua-discount-2.1.8/resource.c Examining data/lua-discount-2.1.8/cstring.h Examining data/lua-discount-2.1.8/mkdio.c Examining data/lua-discount-2.1.8/xml.c Examining data/lua-discount-2.1.8/ldiscount.c Examining data/lua-discount-2.1.8/emmatch.c Examining data/lua-discount-2.1.8/basename.c Examining data/lua-discount-2.1.8/markdown.h Examining data/lua-discount-2.1.8/mkdio.h Examining data/lua-discount-2.1.8/generate.c Examining data/lua-discount-2.1.8/toc.c Examining data/lua-discount-2.1.8/docheader.c Examining data/lua-discount-2.1.8/markdown.c Examining data/lua-discount-2.1.8/config.h Examining data/lua-discount-2.1.8/dumptree.c Examining data/lua-discount-2.1.8/amalloc.h Examining data/lua-discount-2.1.8/Csio.c FINAL RESULTS: data/lua-discount-2.1.8/Csio.c:22:9: [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. siz = vsnprintf(T(*iot) + S(*iot), ALLOCATED(*iot) - S(*iot), data/lua-discount-2.1.8/basename.c:24: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(ret, base); data/lua-discount-2.1.8/generate.c:133:2: [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. vsnprintf(bfr, sizeof bfr, fmt, ptr); data/lua-discount-2.1.8/markdown.c:619:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(p->ident, "%s=\"%.*s\"", prefix, data/lua-discount-2.1.8/config.h:11:20: [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. #define INITRNG(x) srand((unsigned int)x) data/lua-discount-2.1.8/Csio.c:36:2: [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(T(*iot) + S(*iot), bfr, size); data/lua-discount-2.1.8/cstring.h:48:2: [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(t) += (sz)) - (sz)) + \ data/lua-discount-2.1.8/cstring.h:59:2: [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(T(t), (p), (sz)); \ data/lua-discount-2.1.8/emmatch.c:87: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 open[10]; data/lua-discount-2.1.8/emmatch.c:87: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). char open[10]; data/lua-discount-2.1.8/emmatch.c:88: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 close[10]; data/lua-discount-2.1.8/emmatch.c:135:43: [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). PREFIX(start->b_text, emtags[match - 1].open, data/lua-discount-2.1.8/generate.c:129: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 bfr[80]; data/lua-discount-2.1.8/basename.c:23:20: [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). (ret = malloc(strlen(base) + size + 2))) { data/lua-discount-2.1.8/basename.c:25:3: [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(ret, string, size); data/lua-discount-2.1.8/generate.c:445:17: [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). puturl(edit, strlen(edit), f, 0); data/lua-discount-2.1.8/generate.c:808: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). if (!(len = strlen(s))) data/lua-discount-2.1.8/markdown.c:618: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). if (p->ident = malloc(4 + strlen(prefix) + S(q->text))) data/lua-discount-2.1.8/mkdio.c:82:30: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Document *populate(getc_func getc, void *ctx, int flags) data/lua-discount-2.1.8/mkdio.c:98:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = (*getc)(ctx)) != EOF) { data/lua-discount-2.1.8/mkdio.c:141:29: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return populate((getc_func)fgetc, f, flags & INPUT_MASK); data/lua-discount-2.1.8/xml.c:74:24: [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). Cswrite(&f, entity, strlen(entity)); ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 4111 in approximately 0.14 seconds (29592 lines/second) Physical Source Lines of Code (SLOC) = 2976 Hits@level = [0] 11 [1] 9 [2] 8 [3] 1 [4] 4 [5] 0 Hits@level+ = [0+] 33 [1+] 22 [2+] 13 [3+] 5 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 11.0887 [1+] 7.39247 [2+] 4.36828 [3+] 1.68011 [4+] 1.34409 [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.