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/xz-utils-5.2.4/debug/sync_flush.c Examining data/xz-utils-5.2.4/debug/repeat.c Examining data/xz-utils-5.2.4/debug/memusage.c Examining data/xz-utils-5.2.4/debug/known_sizes.c Examining data/xz-utils-5.2.4/debug/hex2bin.c Examining data/xz-utils-5.2.4/debug/full_flush.c Examining data/xz-utils-5.2.4/debug/crc32.c Examining data/xz-utils-5.2.4/tests/bcj_test.c Examining data/xz-utils-5.2.4/tests/tests.h Examining data/xz-utils-5.2.4/tests/test_stream_flags.c Examining data/xz-utils-5.2.4/tests/test_index.c Examining data/xz-utils-5.2.4/tests/test_filter_flags.c Examining data/xz-utils-5.2.4/tests/test_check.c Examining data/xz-utils-5.2.4/tests/test_block_header.c Examining data/xz-utils-5.2.4/tests/test_bcj_exact_size.c Examining data/xz-utils-5.2.4/tests/create_compress_files.c Examining data/xz-utils-5.2.4/src/lzmainfo/lzmainfo.c Examining data/xz-utils-5.2.4/src/xz/list.h Examining data/xz-utils-5.2.4/src/xz/list.c Examining data/xz-utils-5.2.4/src/xz/util.h Examining data/xz-utils-5.2.4/src/xz/util.c Examining data/xz-utils-5.2.4/src/xz/suffix.h Examining data/xz-utils-5.2.4/src/xz/suffix.c Examining data/xz-utils-5.2.4/src/xz/signals.h Examining data/xz-utils-5.2.4/src/xz/signals.c Examining data/xz-utils-5.2.4/src/xz/private.h Examining data/xz-utils-5.2.4/src/xz/options.h Examining data/xz-utils-5.2.4/src/xz/options.c Examining data/xz-utils-5.2.4/src/xz/mytime.h Examining data/xz-utils-5.2.4/src/xz/mytime.c Examining data/xz-utils-5.2.4/src/xz/message.h Examining data/xz-utils-5.2.4/src/xz/message.c Examining data/xz-utils-5.2.4/src/xz/main.h Examining data/xz-utils-5.2.4/src/xz/main.c Examining data/xz-utils-5.2.4/src/xz/hardware.h Examining data/xz-utils-5.2.4/src/xz/hardware.c Examining data/xz-utils-5.2.4/src/xz/file_io.h Examining data/xz-utils-5.2.4/src/xz/file_io.c Examining data/xz-utils-5.2.4/src/xz/coder.h Examining data/xz-utils-5.2.4/src/xz/coder.c Examining data/xz-utils-5.2.4/src/xz/args.h Examining data/xz-utils-5.2.4/src/xz/args.c Examining data/xz-utils-5.2.4/src/xzdec/xzdec.c Examining data/xz-utils-5.2.4/src/liblzma/api/lzma.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/vli.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/version.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/stream_flags.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/lzma12.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/index_hash.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/index.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/hardware.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/filter.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/delta.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/container.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/check.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/block.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/bcj.h Examining data/xz-utils-5.2.4/src/liblzma/api/lzma/base.h Examining data/xz-utils-5.2.4/src/liblzma/simple/sparc.c Examining data/xz-utils-5.2.4/src/liblzma/simple/armthumb.c Examining data/xz-utils-5.2.4/src/liblzma/simple/arm.c Examining data/xz-utils-5.2.4/src/liblzma/simple/ia64.c Examining data/xz-utils-5.2.4/src/liblzma/simple/powerpc.c Examining data/xz-utils-5.2.4/src/liblzma/simple/x86.c Examining data/xz-utils-5.2.4/src/liblzma/simple/simple_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/simple/simple_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/simple/simple_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/simple/simple_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/simple/simple_private.h Examining data/xz-utils-5.2.4/src/liblzma/simple/simple_coder.h Examining data/xz-utils-5.2.4/src/liblzma/simple/simple_coder.c Examining data/xz-utils-5.2.4/src/liblzma/rangecoder/price_tablegen.c Examining data/xz-utils-5.2.4/src/liblzma/rangecoder/range_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/rangecoder/price_table.c Examining data/xz-utils-5.2.4/src/liblzma/rangecoder/price.h Examining data/xz-utils-5.2.4/src/liblzma/rangecoder/range_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/rangecoder/range_common.h Examining data/xz-utils-5.2.4/src/liblzma/lzma/fastpos_tablegen.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma2_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma2_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma2_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma2_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/fastpos_table.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_encoder_optimum_normal.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_encoder_optimum_fast.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_encoder_private.h Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/lzma/fastpos.h Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_encoder_presets.c Examining data/xz-utils-5.2.4/src/liblzma/lzma/lzma_common.h Examining data/xz-utils-5.2.4/src/liblzma/lz/lz_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/lz/lz_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/lz/lz_encoder_mf.c Examining data/xz-utils-5.2.4/src/liblzma/lz/lz_encoder_hash_table.h Examining data/xz-utils-5.2.4/src/liblzma/lz/lz_encoder_hash.h Examining data/xz-utils-5.2.4/src/liblzma/lz/lz_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/lz/lz_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/delta/delta_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/delta/delta_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/delta/delta_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/delta/delta_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/delta/delta_private.h Examining data/xz-utils-5.2.4/src/liblzma/delta/delta_common.h Examining data/xz-utils-5.2.4/src/liblzma/delta/delta_common.c Examining data/xz-utils-5.2.4/src/liblzma/common/vli_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_flags_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/stream_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_buffer_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/index_hash.c Examining data/xz-utils-5.2.4/src/liblzma/common/index_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/filter_flags_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/filter_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/filter_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/filter_buffer_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/easy_decoder_memusage.c Examining data/xz-utils-5.2.4/src/liblzma/common/block_header_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/block_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/block_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/block_buffer_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/auto_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/alone_decoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/alone_decoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_encoder_mt.c Examining data/xz-utils-5.2.4/src/liblzma/common/outqueue.h Examining data/xz-utils-5.2.4/src/liblzma/common/outqueue.c Examining data/xz-utils-5.2.4/src/liblzma/common/vli_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_flags_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_buffer_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/index_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/index_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/filter_flags_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/filter_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/filter_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/filter_buffer_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/easy_encoder_memusage.c Examining data/xz-utils-5.2.4/src/liblzma/common/easy_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/easy_buffer_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/block_header_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/block_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/block_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/block_buffer_encoder.h Examining data/xz-utils-5.2.4/src/liblzma/common/block_buffer_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/alone_encoder.c Examining data/xz-utils-5.2.4/src/liblzma/common/hardware_cputhreads.c Examining data/xz-utils-5.2.4/src/liblzma/common/vli_size.c Examining data/xz-utils-5.2.4/src/liblzma/common/stream_flags_common.h Examining data/xz-utils-5.2.4/src/liblzma/common/stream_flags_common.c Examining data/xz-utils-5.2.4/src/liblzma/common/index.h Examining data/xz-utils-5.2.4/src/liblzma/common/index.c Examining data/xz-utils-5.2.4/src/liblzma/common/hardware_physmem.c Examining data/xz-utils-5.2.4/src/liblzma/common/filter_common.h Examining data/xz-utils-5.2.4/src/liblzma/common/filter_common.c Examining data/xz-utils-5.2.4/src/liblzma/common/easy_preset.h Examining data/xz-utils-5.2.4/src/liblzma/common/easy_preset.c Examining data/xz-utils-5.2.4/src/liblzma/common/block_util.c Examining data/xz-utils-5.2.4/src/liblzma/common/memcmplen.h Examining data/xz-utils-5.2.4/src/liblzma/common/common.h Examining data/xz-utils-5.2.4/src/liblzma/common/common.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc64_tablegen.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc32_tablegen.c Examining data/xz-utils-5.2.4/src/liblzma/check/sha256.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc64_fast.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc64_table_be.h Examining data/xz-utils-5.2.4/src/liblzma/check/crc64_table_le.h Examining data/xz-utils-5.2.4/src/liblzma/check/crc64_table.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc64_small.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc32_fast.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc32_table_be.h Examining data/xz-utils-5.2.4/src/liblzma/check/crc32_table_le.h Examining data/xz-utils-5.2.4/src/liblzma/check/crc32_table.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc32_small.c Examining data/xz-utils-5.2.4/src/liblzma/check/crc_macros.h Examining data/xz-utils-5.2.4/src/liblzma/check/check.h Examining data/xz-utils-5.2.4/src/liblzma/check/check.c Examining data/xz-utils-5.2.4/src/common/tuklib_progname.h Examining data/xz-utils-5.2.4/src/common/tuklib_progname.c Examining data/xz-utils-5.2.4/src/common/tuklib_physmem.h Examining data/xz-utils-5.2.4/src/common/tuklib_physmem.c Examining data/xz-utils-5.2.4/src/common/tuklib_open_stdxxx.h Examining data/xz-utils-5.2.4/src/common/tuklib_open_stdxxx.c Examining data/xz-utils-5.2.4/src/common/tuklib_mbstr_width.c Examining data/xz-utils-5.2.4/src/common/tuklib_mbstr.h Examining data/xz-utils-5.2.4/src/common/tuklib_mbstr_fw.c Examining data/xz-utils-5.2.4/src/common/tuklib_integer.h Examining data/xz-utils-5.2.4/src/common/tuklib_gettext.h Examining data/xz-utils-5.2.4/src/common/tuklib_exit.h Examining data/xz-utils-5.2.4/src/common/tuklib_exit.c Examining data/xz-utils-5.2.4/src/common/tuklib_cpucores.h Examining data/xz-utils-5.2.4/src/common/tuklib_cpucores.c Examining data/xz-utils-5.2.4/src/common/tuklib_config.h Examining data/xz-utils-5.2.4/src/common/tuklib_common.h Examining data/xz-utils-5.2.4/src/common/sysdefs.h Examining data/xz-utils-5.2.4/src/common/mythread.h Examining data/xz-utils-5.2.4/lib/getopt_int.h Examining data/xz-utils-5.2.4/lib/getopt.in.h Examining data/xz-utils-5.2.4/lib/getopt1.c Examining data/xz-utils-5.2.4/lib/getopt.c Examining data/xz-utils-5.2.4/windows/vs2017/config.h Examining data/xz-utils-5.2.4/windows/vs2013/config.h Examining data/xz-utils-5.2.4/dos/config.h Examining data/xz-utils-5.2.4/extra/scanlzma/scanlzma.c Examining data/xz-utils-5.2.4/doc/examples_old/xz_pipe_decomp.c Examining data/xz-utils-5.2.4/doc/examples_old/xz_pipe_comp.c Examining data/xz-utils-5.2.4/doc/examples/04_compress_easy_mt.c Examining data/xz-utils-5.2.4/doc/examples/03_compress_custom.c Examining data/xz-utils-5.2.4/doc/examples/02_decompress.c Examining data/xz-utils-5.2.4/doc/examples/01_compress_easy.c FINAL RESULTS: data/xz-utils-5.2.4/src/liblzma/check/crc32_tablegen.c:66:4: [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. printf("0x%08" PRIX32, crc32_table[s][b]); data/xz-utils-5.2.4/src/liblzma/check/crc32_tablegen.c:93:3: [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. printf("0x%08" PRIX32, crc32_table[0][b]); data/xz-utils-5.2.4/src/liblzma/rangecoder/price_tablegen.c:69:3: [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. printf("%4" PRIu32, rc_prices[i]); data/xz-utils-5.2.4/src/xz/list.c:566:3: [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(check_value, sizeof(check_value), data/xz-utils-5.2.4/src/xz/list.c:569:3: [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(check_value, sizeof(check_value), data/xz-utils-5.2.4/src/xz/list.c:1057:2: [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. printf(ngettext("%s file\n", "%s files\n", data/xz-utils-5.2.4/src/xz/list.c:1096:2: [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. printf("totals\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 data/xz-utils-5.2.4/src/xz/list.c:1109:3: [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. printf("\t%" PRIu64 "\t%s\t%" PRIu32, data/xz-utils-5.2.4/src/xz/message.c:405:3: [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/xz-utils-5.2.4/src/xz/message.c:409:3: [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), "%" PRIu32 ":%02" PRIu32, data/xz-utils-5.2.4/src/xz/message.c:715: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, fmt, ap); data/xz-utils-5.2.4/src/xz/message.c:896:3: [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), "%" PRIu32, num); data/xz-utils-5.2.4/src/xz/util.c:168:3: [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(bufs[slot], sizeof(bufs[slot]), "%'" PRIu64, value); data/xz-utils-5.2.4/src/xz/util.c:170:3: [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(bufs[slot], sizeof(bufs[slot]), "%" PRIu64, value); data/xz-utils-5.2.4/src/xz/util.c:233:18: [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. const int len = vsnprintf(*pos, *left, fmt, ap); data/xz-utils-5.2.4/src/xzdec/xzdec.c:51: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, fmt, ap); data/xz-utils-5.2.4/src/xzdec/xzdec.c:87:2: [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. printf(TOOL_FORMAT "dec (" PACKAGE_NAME ") " LZMA_VERSION_STRING "\n" data/xz-utils-5.2.4/lib/getopt.c:115:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. extern char *getenv (); data/xz-utils-5.2.4/lib/getopt.c:250:47: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); data/xz-utils-5.2.4/lib/getopt.c:1122:1: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt (int argc, char *const *argv, const char *optstring) data/xz-utils-5.2.4/lib/getopt.c:1144:11: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt (argc, argv, "abc:d:0123456789"); data/xz-utils-5.2.4/lib/getopt.in.h:39:9: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. # undef getopt data/xz-utils-5.2.4/lib/getopt.in.h:40:9: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. # undef getopt_long data/xz-utils-5.2.4/lib/getopt.in.h:49:10: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. # define getopt __GETOPT_ID (getopt) data/xz-utils-5.2.4/lib/getopt.in.h:49:30: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. # define getopt __GETOPT_ID (getopt) data/xz-utils-5.2.4/lib/getopt.in.h:50:10: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. # define getopt_long __GETOPT_ID (getopt_long) data/xz-utils-5.2.4/lib/getopt.in.h:50:35: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. # define getopt_long __GETOPT_ID (getopt_long) data/xz-utils-5.2.4/lib/getopt.in.h:204:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) data/xz-utils-5.2.4/lib/getopt.in.h:208:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, data/xz-utils-5.2.4/lib/getopt1.c:41:1: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, data/xz-utils-5.2.4/lib/getopt1.c:106:11: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long (argc, argv, "abc:d:0123456789", data/xz-utils-5.2.4/src/common/mythread.h:415:2: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(mutex); data/xz-utils-5.2.4/src/common/mythread.h:428:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/xz-utils-5.2.4/src/common/mythread.h:476:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/xz-utils-5.2.4/src/common/mythread.h:500:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/xz-utils-5.2.4/src/lzmainfo/lzmainfo.c:72:14: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long(argc, argv, "", long_opts, NULL)) != -1) { data/xz-utils-5.2.4/src/xz/args.c:215:14: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) data/xz-utils-5.2.4/src/xz/args.c:513:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *env = getenv(varname); data/xz-utils-5.2.4/src/xz/main.c:36:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&exit_status_cs); data/xz-utils-5.2.4/src/xz/main.c:146:2: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&exit_status_cs); data/xz-utils-5.2.4/src/xz/main.c:315:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&exit_status_cs); data/xz-utils-5.2.4/src/xzdec/xzdec.c:114:14: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) data/xz-utils-5.2.4/tests/create_compress_files.c:155:14: [3] (random) random: 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. create_test(random); data/xz-utils-5.2.4/debug/full_flush.c:66:23: [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_in = argc > 1 ? fopen(argv[1], "rb") : stdin; data/xz-utils-5.2.4/debug/sync_flush.c:66:23: [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_in = argc > 1 ? fopen(argv[1], "rb") : stdin; data/xz-utils-5.2.4/doc/examples/02_decompress.c:264:18: [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 *infile = fopen(argv[i], "rb"); data/xz-utils-5.2.4/extra/scanlzma/scanlzma.c:55:11: [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 buf[BUFSIZE]; data/xz-utils-5.2.4/extra/scanlzma/scanlzma.c:64:12: [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). numlzma = atoi(argv[1]); data/xz-utils-5.2.4/src/common/tuklib_open_stdxxx.c:38:19: [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). const int fd = open("/dev/null", O_NOCTTY data/xz-utils-5.2.4/src/liblzma/check/sha256.c:134: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(check->state.sha256.state, s, sizeof(s)); data/xz-utils-5.2.4/src/liblzma/check/sha256.c:154: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(check->buffer.u8 + copy_start, buf, copy_size); data/xz-utils-5.2.4/src/liblzma/common/block_buffer_encoder.c:152: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(out + *out_pos, in + in_pos, copy_size); data/xz-utils-5.2.4/src/liblzma/common/block_buffer_encoder.c:309: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(block->raw_check, check.buffer.u8, check_size); data/xz-utils-5.2.4/src/liblzma/common/block_buffer_encoder.c:310: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(out + *out_pos, check.buffer.u8, check_size); data/xz-utils-5.2.4/src/liblzma/common/block_encoder.c:128: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(coder->block->raw_check, coder->check.buffer.u8, data/xz-utils-5.2.4/src/liblzma/common/common.c:102: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(out + *out_pos, in + *in_pos, copy_size); data/xz-utils-5.2.4/src/liblzma/common/filter_common.c:170:4: [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[i].options, src[i].options, data/xz-utils-5.2.4/src/liblzma/common/index.c:814:4: [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(newg->records, g->records, newg->allocated data/xz-utils-5.2.4/src/liblzma/common/index.c:910: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(destg->records + i, srcg->records, data/xz-utils-5.2.4/src/liblzma/common/stream_flags_encoder.c:39: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(out, lzma_header_magic, sizeof(lzma_header_magic)); data/xz-utils-5.2.4/src/liblzma/common/stream_flags_encoder.c:82: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(out + 2 * 4 + LZMA_STREAM_FLAGS_SIZE, data/xz-utils-5.2.4/src/liblzma/lz/lz_decoder.c:97: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(out + *out_pos, coder->dict.buf + dict_start, data/xz-utils-5.2.4/src/liblzma/lz/lz_decoder.c:277: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(coder->dict.buf, lz_options.preset_dict + offset, data/xz-utils-5.2.4/src/liblzma/lz/lz_decoder.h:148: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(dict->buf + dict->pos, data/xz-utils-5.2.4/src/liblzma/lz/lz_decoder.h:167:4: [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(dict->buf + dict->pos, dict->buf, copy_size); data/xz-utils-5.2.4/src/liblzma/lz/lz_encoder.c:450: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(mf->buffer, lz_options->preset_dict data/xz-utils-5.2.4/src/liblzma/lz/lz_encoder.h:288: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(out + *out_pos, mf->buffer + mf->read_pos - *left, data/xz-utils-5.2.4/src/liblzma/simple/simple_coder.c:121: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(out + *out_pos, coder->buffer + coder->pos, buf_avail); data/xz-utils-5.2.4/src/liblzma/simple/simple_coder.c:156:4: [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(coder->buffer, out + *out_pos, unfiltered); data/xz-utils-5.2.4/src/lzmainfo/lzmainfo.c:199: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(argv[optind], "r"); data/xz-utils-5.2.4/src/xz/args.c:391: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 str[8]; data/xz-utils-5.2.4/src/xz/args.c:417: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 str[8]; data/xz-utils-5.2.4/src/xz/args.c:482:24: [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). args->files_file = fopen(optarg, data/xz-utils-5.2.4/src/xz/args.c:679:10: [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 char *names_stdin[2] = { (char *)"-", NULL }; data/xz-utils-5.2.4/src/xz/file_io.c:584:17: [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). pair->src_fd = open(pair->src_name, flags); data/xz-utils-5.2.4/src/xz/file_io.c:891:19: [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). pair->dest_fd = open(pair->dest_name, flags, mode); data/xz-utils-5.2.4/src/xz/list.c:46: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 flags[3]; data/xz-utils-5.2.4/src/xz/list.c:55: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 filter_chain[FILTERS_STR_SIZE]; data/xz-utils-5.2.4/src/xz/list.c:61: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 check_names[LZMA_CHECK_ID_MAX + 1][12] = { data/xz-utils-5.2.4/src/xz/list.c:95:8: [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 char check_value[2 * LZMA_CHECK_SIZE_MAX + 1]; data/xz-utils-5.2.4/src/xz/list.c:119:9: [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 char buf[32]; data/xz-utils-5.2.4/src/xz/list.c:621:9: [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 char buf[16]; data/xz-utils-5.2.4/src/xz/list.c:638: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. get_check_names(char buf[CHECKS_STR_SIZE], data/xz-utils-5.2.4/src/xz/list.c:681: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 checks[CHECKS_STR_SIZE]; data/xz-utils-5.2.4/src/xz/list.c:684:8: [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. const char *cols[7] = { data/xz-utils-5.2.4/src/xz/list.c:714: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 checks_str[CHECKS_STR_SIZE]; data/xz-utils-5.2.4/src/xz/list.c:767:9: [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. const char *cols1[4] = { data/xz-utils-5.2.4/src/xz/list.c:779:9: [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. const char *cols2[5] = { data/xz-utils-5.2.4/src/xz/list.c:839:10: [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. const char *cols1[4] = { data/xz-utils-5.2.4/src/xz/list.c:854:10: [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. const char *cols2[4] = { data/xz-utils-5.2.4/src/xz/list.c:876:11: [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. const char *cols3[6] = { data/xz-utils-5.2.4/src/xz/list.c:918: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 checks[CHECKS_STR_SIZE]; data/xz-utils-5.2.4/src/xz/list.c:1028: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 line[80]; data/xz-utils-5.2.4/src/xz/list.c:1034: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 checks[CHECKS_STR_SIZE]; data/xz-utils-5.2.4/src/xz/list.c:1093: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 checks[CHECKS_STR_SIZE]; data/xz-utils-5.2.4/src/xz/message.c:299:9: [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 char buf[16]; data/xz-utils-5.2.4/src/xz/message.c:312:9: [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 char buf[128]; data/xz-utils-5.2.4/src/xz/message.c:377:9: [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 char buf[16]; data/xz-utils-5.2.4/src/xz/message.c:390:9: [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 char buf[sizeof("9999:59:59")]; data/xz-utils-5.2.4/src/xz/message.c:442:9: [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 char buf[sizeof("9 h 55 min")]; data/xz-utils-5.2.4/src/xz/message.c:562:8: [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. const char *cols[5] = { data/xz-utils-5.2.4/src/xz/message.c:644:9: [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. const char *cols[5] = { data/xz-utils-5.2.4/src/xz/message.c:857: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 memlimitstr[128]; data/xz-utils-5.2.4/src/xz/message.c:889:9: [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 char buf[16]; data/xz-utils-5.2.4/src/xz/message.c:903:24: [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. message_filters_to_str(char buf[FILTERS_STR_SIZE], data/xz-utils-5.2.4/src/xz/message.c:1041: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 buf[FILTERS_STR_SIZE]; data/xz-utils-5.2.4/src/xz/message.h:105: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. extern void message_filters_to_str(char buf[FILTERS_STR_SIZE], data/xz-utils-5.2.4/src/xz/suffix.c:172: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(dest_name, src_name, new_len); data/xz-utils-5.2.4/src/xz/suffix.c:173: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(dest_name + new_len, new_suffix, new_suffix_len); data/xz-utils-5.2.4/src/xz/suffix.c:364: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(dest_name, src_name, src_len); data/xz-utils-5.2.4/src/xz/suffix.c:365: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(dest_name + src_len, suffix, suffix_len); data/xz-utils-5.2.4/src/xz/util.c:18:8: [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 char bufs[4][128]; data/xz-utils-5.2.4/src/xz/util.c:53: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. return memcpy(dest, src, size); data/xz-utils-5.2.4/src/xz/util.c:214:15: [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 suffix[5][4] = { "B", "KiB", "MiB", "GiB", "TiB" }; data/xz-utils-5.2.4/src/xzdec/xzdec.c:303:18: [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 *file = fopen(argv[optind], "rb"); data/xz-utils-5.2.4/tests/create_compress_files.c:35: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 *file = fopen(filename, "rb"); data/xz-utils-5.2.4/tests/create_compress_files.c:52: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 *file = fopen(filename, "wb"); data/xz-utils-5.2.4/debug/hex2bin.c:35:14: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int byte = getchar(); data/xz-utils-5.2.4/debug/hex2bin.c:41:21: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const int digit = getchar(); data/xz-utils-5.2.4/debug/repeat.c:30:22: [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). const size_t size = strlen(argv[2]); data/xz-utils-5.2.4/extra/scanlzma/scanlzma.c:78:11: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getchar(); data/xz-utils-5.2.4/lib/getopt.c:281:49: [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). int len = d->__nonoption_flags_max_len = strlen (orig_str); data/xz-utils-5.2.4/lib/getopt.c:508:21: [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). == (unsigned int) strlen (p->name)) data/xz-utils-5.2.4/lib/getopt.c:557:21: [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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/lib/getopt.c:630:22: [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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/lib/getopt.c:670:22: [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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/lib/getopt.c:675:21: [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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/lib/getopt.c:878:56: [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 ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) data/xz-utils-5.2.4/lib/getopt.c:923: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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/lib/getopt.c:967: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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/lib/getopt.c:1005: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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/lib/getopt.c:1009: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). d->__nextchar += strlen (d->__nextchar); data/xz-utils-5.2.4/src/common/tuklib_mbstr_width.c:23:21: [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). const size_t len = strlen(str); data/xz-utils-5.2.4/src/common/tuklib_progname.c:31:22: [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). char *p = argv[0] + strlen(argv[0]); data/xz-utils-5.2.4/src/xz/args.c:40:21: [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). const size_t len = strlen(str); data/xz-utils-5.2.4/src/xz/file_io.c:1121:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t amount = read(pair->src_fd, buf, left); data/xz-utils-5.2.4/src/xz/main.c:81:17: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const int c = fgetc(args->files_file); data/xz-utils-5.2.4/src/xz/suffix.c:89:28: [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). const size_t suffix_len = strlen(suffix); data/xz-utils-5.2.4/src/xz/suffix.c:169:32: [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). const size_t new_suffix_len = strlen(new_suffix); data/xz-utils-5.2.4/src/xz/suffix.c:266:22: [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 suffix_len = strlen(suffix); data/xz-utils-5.2.4/src/xz/suffix.c:354: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(sufsep) > 4 - suffix_len) data/xz-utils-5.2.4/src/xz/suffix.c:379:25: [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). const size_t src_len = strlen(src_name); data/xz-utils-5.2.4/src/xz/util.c:51:22: [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). const size_t size = strlen(src) + 1; ANALYSIS SUMMARY: Hits = 143 Lines analyzed = 43534 in approximately 0.96 seconds (45228 lines/second) Physical Source Lines of Code (SLOC) = 24373 Hits@level = [0] 219 [1] 26 [2] 74 [3] 26 [4] 17 [5] 0 Hits@level+ = [0+] 362 [1+] 143 [2+] 117 [3+] 43 [4+] 17 [5+] 0 Hits/KSLOC@level+ = [0+] 14.8525 [1+] 5.86715 [2+] 4.80039 [3+] 1.76425 [4+] 0.697493 [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.