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/libi8x-0.0.5/contrib/threads.c Examining data/libi8x-0.0.5/examples/libthread_db.c Examining data/libi8x-0.0.5/examples/proc_service.h Examining data/libi8x-0.0.5/libi8x-test/execution-test.h Examining data/libi8x-0.0.5/libi8x-test/libi8x-test.c Examining data/libi8x-0.0.5/libi8x-test/libi8x-test.h Examining data/libi8x-0.0.5/libi8x-test/validation-test.h Examining data/libi8x-0.0.5/libi8x/archspec.h Examining data/libi8x-0.0.5/libi8x/chunk.c Examining data/libi8x-0.0.5/libi8x/code.c Examining data/libi8x-0.0.5/libi8x/context.c Examining data/libi8x-0.0.5/libi8x/dbg-interp.c Examining data/libi8x-0.0.5/libi8x/errors.c Examining data/libi8x-0.0.5/libi8x/funcref-private.h Examining data/libi8x-0.0.5/libi8x/funcref.c Examining data/libi8x-0.0.5/libi8x/function.c Examining data/libi8x-0.0.5/libi8x/inferior-private.h Examining data/libi8x-0.0.5/libi8x/inferior.c Examining data/libi8x-0.0.5/libi8x/interp-private.h Examining data/libi8x-0.0.5/libi8x/interp.c Examining data/libi8x-0.0.5/libi8x/libi8x-private.h Examining data/libi8x-0.0.5/libi8x/libi8x.h Examining data/libi8x-0.0.5/libi8x/list.c Examining data/libi8x-0.0.5/libi8x/note.c Examining data/libi8x-0.0.5/libi8x/object.c Examining data/libi8x-0.0.5/libi8x/opcodes.h Examining data/libi8x-0.0.5/libi8x/optable.c Examining data/libi8x-0.0.5/libi8x/readbuf.c Examining data/libi8x-0.0.5/libi8x/reloc-private.h Examining data/libi8x-0.0.5/libi8x/reloc.c Examining data/libi8x-0.0.5/libi8x/type.c Examining data/libi8x-0.0.5/libi8x/validator.c Examining data/libi8x-0.0.5/libi8x/xctx-private.h Examining data/libi8x-0.0.5/libi8x/xctx.c Examining data/libi8x-0.0.5/python/pycparser/utils/fake_libc_include/_fake_defines.h Examining data/libi8x-0.0.5/python/pycparser/utils/fake_libc_include/_fake_typedefs.h Examining data/libi8x-0.0.5/python/pycparser/utils/fake_libc_include/stdarg.h Examining data/libi8x-0.0.5/python/pycparser/utils/fake_libc_include/stdbool.h Examining data/libi8x-0.0.5/python/pycparser/utils/fake_libc_include/stdint.h Examining data/libi8x-0.0.5/python/pycparser/utils/fake_libc_include/stdlib.h Examining data/libi8x-0.0.5/tests/bugs/test-bug-0001.c Examining data/libi8x-0.0.5/tests/bugs/test-bug-0002.c Examining data/libi8x-0.0.5/tests/bugs/test-bug-0003.c Examining data/libi8x-0.0.5/tests/exec/ops/test-deref.c Examining data/libi8x-0.0.5/tests/exec/test-factorial.c Examining data/libi8x-0.0.5/tests/exec/test-smoke.c Examining data/libi8x-0.0.5/tests/valid/test-corpus.c FINAL RESULTS: data/libi8x-0.0.5/libi8x-test/libi8x-test.c:45:7: [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, format, args); data/libi8x-0.0.5/libi8x-test/libi8x-test.h:46:41: [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. __attribute__ ((__noreturn__, format (printf, 5, 6))); data/libi8x-0.0.5/libi8x/code.c:885:7: [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. snprintf (buf, bufsiz, LDEC, value.i); data/libi8x-0.0.5/libi8x/code.c:893:7: [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. snprintf (buf, bufsiz, ULDEC, value.u); data/libi8x-0.0.5/libi8x/code.c:897:7: [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. snprintf (buf, bufsiz, LHEX, value.u); data/libi8x-0.0.5/libi8x/code.c:938:2: [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. snprintf (fnext, sizeof (fnext), "=> " LHEX, data/libi8x-0.0.5/libi8x/code.c:942:2: [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. snprintf (bnext, sizeof (bnext), ", " LHEX, data/libi8x-0.0.5/libi8x/context.c:99:3: [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, format, args); data/libi8x-0.0.5/libi8x/context.c:475:37: [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. static void __attribute__ ((format (printf, 3, 4))) data/libi8x-0.0.5/libi8x/context.c:483:3: [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 (buf, bufsiz, format, args); data/libi8x-0.0.5/libi8x/dbg-interp.c:39:7: [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. snprintf (buf, sizeof (buf), \ data/libi8x-0.0.5/libi8x/errors.c:33:3: [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, format, args); data/libi8x-0.0.5/libi8x/libi8x-private.h:84:41: [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. __attribute__ ((__noreturn__, format (printf, 4, 5))); data/libi8x-0.0.5/libi8x/libi8x-private.h:124:27: [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. __attribute__ ((format (printf, 6, 7))); data/libi8x-0.0.5/tests/exec/test-factorial.c:85:9: [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 (filename, sizeof (filename), data/libi8x-0.0.5/examples/libthread_db.c:335:12: [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). int fd = open (filename, O_RDONLY); data/libi8x-0.0.5/examples/libthread_db.c:446: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 exec_filename[32]; data/libi8x-0.0.5/examples/libthread_db.c:447: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 r_debug[R_DEBUG_WORDS * sizeof(void *)]; data/libi8x-0.0.5/examples/libthread_db.c:448: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 lm[LINK_MAP_WORDS * sizeof(void *)]; data/libi8x-0.0.5/examples/libthread_db.c:460:12: [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). int fd = open (exec_filename, O_RDONLY); data/libi8x-0.0.5/examples/libthread_db.c:518: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 filename[PATH_MAX]; data/libi8x-0.0.5/libi8x-test/libi8x-test.c:35: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[BUFSIZ]; data/libi8x-0.0.5/libi8x-test/libi8x-test.c:57:16: [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 *names[2] = {"be", "el"}; data/libi8x-0.0.5/libi8x-test/libi8x-test.c:69:12: [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). int fd = open (filename, O_RDONLY); data/libi8x-0.0.5/libi8x/code.c:913: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 entry[32] = ""; data/libi8x-0.0.5/libi8x/code.c:921: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 arg1[32]; /* Operand 1. */ data/libi8x-0.0.5/libi8x/code.c:922: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 arg2[32]; /* Operand 2. */ data/libi8x-0.0.5/libi8x/code.c:923: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 fnext[32] = ""; /* Fall through next. */ data/libi8x-0.0.5/libi8x/code.c:924: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 bnext[32] = ""; /* Branch next. */ data/libi8x-0.0.5/libi8x/code.c:926: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 insn[128]; data/libi8x-0.0.5/libi8x/context.c:684: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 (ptr, rtypes_start, rtypes_size); data/libi8x-0.0.5/libi8x/context.c:687: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 (ptr, ptypes_start, ptypes_size); data/libi8x-0.0.5/libi8x/dbg-interp.c:59: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 offset[32], depth[32], stack0[32], stack1[32]; data/libi8x-0.0.5/libi8x/interp.c:425: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 (vsp_floor, args, sizeof (union i8x_value) * ref->num_args); data/libi8x-0.0.5/libi8x/interp.c:726: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 (rets, vsp - ref->num_rets, data/libi8x-0.0.5/libi8x/note.c:101: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 (note->encoded, buf, bufsiz); data/libi8x-0.0.5/libi8x/type.c:315: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 encoded[2] = {encoded_char, '\0'}; data/libi8x-0.0.5/libi8x/validator.c:46: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 (dst, src, stack_depth * sizeof (struct i8x_type *)); \ data/libi8x-0.0.5/tests/bugs/test-bug-0001.c:44: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. CHECK (((char *) testnote_byteorder)[0] == 'x'); data/libi8x-0.0.5/tests/bugs/test-bug-0001.c:45: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. CHECK (((char *) testnote_byteorder)[1] == ')'); data/libi8x-0.0.5/tests/bugs/test-bug-0002.c:44: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. CHECK (((char *) testnote_byteorder)[0] == 'x'); data/libi8x-0.0.5/tests/bugs/test-bug-0002.c:45: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. CHECK (((char *) testnote_byteorder)[1] == ')'); data/libi8x-0.0.5/tests/bugs/test-bug-0003.c:44: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. CHECK (((char *) testnote_byteorder)[0] == 'x'); data/libi8x-0.0.5/tests/bugs/test-bug-0003.c:45: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. CHECK (((char *) testnote_byteorder)[1] == ')'); data/libi8x-0.0.5/tests/exec/ops/test-deref.c:51: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. CHECK (((char *) testnote_byteorder)[0] == 'x'); data/libi8x-0.0.5/tests/exec/ops/test-deref.c:52: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. CHECK (((char *) testnote_byteorder)[1] == ')'); data/libi8x-0.0.5/tests/exec/ops/test-deref.c:189: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 (result, test_memory, len); data/libi8x-0.0.5/tests/exec/test-factorial.c:23: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 *tests[NUM_TESTS] = { data/libi8x-0.0.5/tests/exec/test-factorial.c:78: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[BUFSIZ]; data/libi8x-0.0.5/tests/exec/test-smoke.c:204:20: [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). int note_index = atoi (dash + 1); data/libi8x-0.0.5/tests/exec/test-smoke.c:210:7: [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 (dash, "-%04d", note_index - 1); data/libi8x-0.0.5/tests/valid/test-corpus.c:115:4: [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 msg[BUFSIZ]; data/libi8x-0.0.5/contrib/threads.c:37:3: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar (); data/libi8x-0.0.5/libi8x/code.c:948:4: [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 (bnext, " / ", sizeof (bnext)); data/libi8x-0.0.5/libi8x/code.c:953:4: [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 (bnext, " / ", sizeof (bnext)); data/libi8x-0.0.5/libi8x/context.c:137:39: [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 (strncasecmp (str, pn->name, strlen (pn->name)) == 0) data/libi8x-0.0.5/libi8x/context.c:487: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). *bufp = buf + strlen (buf); data/libi8x-0.0.5/libi8x/context.c:581: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). fullname_size = (strlen (provider) data/libi8x-0.0.5/libi8x/context.c:583:8: [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). + strlen (name) data/libi8x-0.0.5/libi8x/context.c:585:8: [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). + strlen (ptypes) data/libi8x-0.0.5/libi8x/context.c:587:8: [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). + strlen (rtypes) data/libi8x-0.0.5/libi8x/context.c:611: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). ptypes, ptypes + strlen (ptypes), data/libi8x-0.0.5/libi8x/context.c:612: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). rtypes, rtypes + strlen (rtypes), data/libi8x-0.0.5/libi8x/dbg-interp.c:42:7: [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 (buf, "----------", sizeof (buf)); \ data/libi8x-0.0.5/tests/exec/test-smoke.c:203:10: [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). CHECK (strlen (dash) == 5); ANALYSIS SUMMARY: Hits = 65 Lines analyzed = 10082 in approximately 1.32 seconds (7666 lines/second) Physical Source Lines of Code (SLOC) = 6881 Hits@level = [0] 18 [1] 13 [2] 37 [3] 0 [4] 15 [5] 0 Hits@level+ = [0+] 83 [1+] 65 [2+] 52 [3+] 15 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 12.0622 [1+] 9.4463 [2+] 7.55704 [3+] 2.17992 [4+] 2.17992 [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.