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/chafa-1.4.1/chafa/chafa-canvas-config.c Examining data/chafa-1.4.1/chafa/chafa-canvas-config.h Examining data/chafa-1.4.1/chafa/chafa-canvas.c Examining data/chafa-1.4.1/chafa/chafa-canvas.h Examining data/chafa-1.4.1/chafa/chafa-common.h Examining data/chafa-1.4.1/chafa/chafa-features.c Examining data/chafa-1.4.1/chafa/chafa-features.h Examining data/chafa-1.4.1/chafa/chafa-symbol-map.c Examining data/chafa-1.4.1/chafa/chafa-symbol-map.h Examining data/chafa-1.4.1/chafa/chafa-util.c Examining data/chafa-1.4.1/chafa/chafa-util.h Examining data/chafa-1.4.1/chafa/chafa-version-macros.h Examining data/chafa-1.4.1/chafa/chafa.h Examining data/chafa-1.4.1/chafa/internal/chafa-batch.c Examining data/chafa-1.4.1/chafa/internal/chafa-batch.h Examining data/chafa-1.4.1/chafa/internal/chafa-bitfield.h Examining data/chafa-1.4.1/chafa/internal/chafa-color-hash.c Examining data/chafa-1.4.1/chafa/internal/chafa-color-hash.h Examining data/chafa-1.4.1/chafa/internal/chafa-color-table.c Examining data/chafa-1.4.1/chafa/internal/chafa-color-table.h Examining data/chafa-1.4.1/chafa/internal/chafa-color.c Examining data/chafa-1.4.1/chafa/internal/chafa-color.h Examining data/chafa-1.4.1/chafa/internal/chafa-dither.c Examining data/chafa-1.4.1/chafa/internal/chafa-dither.h Examining data/chafa-1.4.1/chafa/internal/chafa-indexed-image.c Examining data/chafa-1.4.1/chafa/internal/chafa-indexed-image.h Examining data/chafa-1.4.1/chafa/internal/chafa-mmx.c Examining data/chafa-1.4.1/chafa/internal/chafa-palette.c Examining data/chafa-1.4.1/chafa/internal/chafa-palette.h Examining data/chafa-1.4.1/chafa/internal/chafa-pca.c Examining data/chafa-1.4.1/chafa/internal/chafa-pca.h Examining data/chafa-1.4.1/chafa/internal/chafa-popcnt.c Examining data/chafa-1.4.1/chafa/internal/chafa-private.h Examining data/chafa-1.4.1/chafa/internal/chafa-sixel-canvas.c Examining data/chafa-1.4.1/chafa/internal/chafa-sixel-canvas.h Examining data/chafa-1.4.1/chafa/internal/chafa-sse41.c Examining data/chafa-1.4.1/chafa/internal/chafa-symbols-ascii.h Examining data/chafa-1.4.1/chafa/internal/chafa-symbols.c Examining data/chafa-1.4.1/chafa/internal/smolscale/smolscale-avx2.c Examining data/chafa-1.4.1/chafa/internal/smolscale/smolscale-private.h Examining data/chafa-1.4.1/chafa/internal/smolscale/smolscale.c Examining data/chafa-1.4.1/chafa/internal/smolscale/smolscale.h Examining data/chafa-1.4.1/libnsgif/libnsgif.c Examining data/chafa-1.4.1/libnsgif/libnsgif.h Examining data/chafa-1.4.1/libnsgif/log.h Examining data/chafa-1.4.1/libnsgif/lzw.c Examining data/chafa-1.4.1/libnsgif/lzw.h Examining data/chafa-1.4.1/tests/example.c Examining data/chafa-1.4.1/tools/chafa/chafa.c Examining data/chafa-1.4.1/tools/chafa/file-mapping.c Examining data/chafa-1.4.1/tools/chafa/file-mapping.h Examining data/chafa-1.4.1/tools/chafa/font-loader.c Examining data/chafa-1.4.1/tools/chafa/font-loader.h Examining data/chafa-1.4.1/tools/chafa/gif-loader.c Examining data/chafa-1.4.1/tools/chafa/gif-loader.h Examining data/chafa-1.4.1/tools/chafa/named-colors.c Examining data/chafa-1.4.1/tools/chafa/named-colors.h Examining data/chafa-1.4.1/tools/chafa/xwd-loader.c Examining data/chafa-1.4.1/tools/chafa/xwd-loader.h FINAL RESULTS: data/chafa-1.4.1/libnsgif/log.h:18:23: [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 LOG(x) do { fprintf(stderr, x), fputc('\n', stderr); } while (0) data/chafa-1.4.1/chafa/chafa-canvas-config.c: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 (dest, src, sizeof (*dest)); data/chafa-1.4.1/chafa/chafa-canvas.c:266: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 (index, index_init, CHAFA_SYMBOL_N_PIXELS); data/chafa-1.4.1/chafa/chafa-canvas.c:2089: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 (canvas, orig, sizeof (*canvas)); data/chafa-1.4.1/chafa/chafa-symbol-map.c:758: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 (dest, src, sizeof (*dest)); data/chafa-1.4.1/chafa/chafa-symbol-map.c:896: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 (candidates_out, candidates, i * sizeof (ChafaCandidate)); data/chafa-1.4.1/chafa/chafa-symbol-map.c:990: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 (candidates_out, candidates, i * sizeof (ChafaCandidate)); data/chafa-1.4.1/chafa/internal/chafa-dither.c:83: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 (dest, src, sizeof (*dest)); data/chafa-1.4.1/chafa/internal/chafa-palette.c:546: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 (dest, src, sizeof (*dest)); data/chafa-1.4.1/chafa/internal/chafa-pca.c:121: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 (v, vecs_in, n_vecs * sizeof (ChafaVec3f32)); data/chafa-1.4.1/chafa/internal/chafa-sixel-canvas.c:244:13: [2] (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). Risk is low because the source is a constant string. strcpy (p, "!255"); data/chafa-1.4.1/chafa/internal/smolscale/smolscale-avx2.c:1728: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 (row_parts_out, row_parts_in, scale_ctx->width_out * sizeof (uint64_t)); data/chafa-1.4.1/chafa/internal/smolscale/smolscale-avx2.c:1739: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 (row_parts_out, row_parts_in, scale_ctx->width_out * 2 * sizeof (uint64_t)); data/chafa-1.4.1/chafa/internal/smolscale/smolscale.c:1602: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 (row_parts_out, row_parts_in, scale_ctx->width_out * sizeof (uint64_t)); data/chafa-1.4.1/chafa/internal/smolscale/smolscale.c:1613: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 (row_parts_out, row_parts_in, scale_ctx->width_out * 2 * sizeof (uint64_t)); data/chafa-1.4.1/libnsgif/libnsgif.c:1115:36: [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. ((unsigned char *) entry)[3] = 0xff; data/chafa-1.4.1/tools/chafa/file-mapping.c:127: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). return open (file_mapping->path, O_RDONLY); data/chafa-1.4.1/tools/chafa/chafa.c:158: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). if (len != (gint) strlen (p0) || len < 6) data/chafa-1.4.1/tools/chafa/chafa.c:811:9: [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 (strlen (vte_version) > 0) data/chafa-1.4.1/tools/chafa/chafa.c:856: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). if (strlen (tmux) > 0) data/chafa-1.4.1/tools/chafa/file-mapping.c:70:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iread = read (fd, buffer, nread); data/chafa-1.4.1/tools/chafa/named-colors.c:721:30: [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). mangled_name = g_malloc (strlen (name) + 1); ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 25157 in approximately 0.60 seconds (41891 lines/second) Physical Source Lines of Code (SLOC) = 18719 Hits@level = [0] 13 [1] 5 [2] 16 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 35 [1+] 22 [2+] 17 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 1.86976 [1+] 1.17528 [2+] 0.908168 [3+] 0.0534217 [4+] 0.0534217 [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.