Add an explicit check for unsupported algos to make the error obvious - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 874e674f9ffc61d83ff6e756d9749d4ae9d1129b DIR parent 738efabad162925277a2e7bb809ea127fd75d497 HTML Author: sin <sin@2f30.org> Date: Wed, 10 Apr 2019 13:52:45 +0100 Add an explicit check for unsupported algos to make the error obvious Diffstat: M dedup.c | 6 ++++++ 1 file changed, 6 insertions(+), 0 deletions(-) --- DIR diff --git a/dedup.c b/dedup.c @@ -470,9 +470,15 @@ load_blk_hdr(void) v &= COMPR_ALGO_MASK; compr_algo = v; + if (compr_algo < 0 || compr_algo >= NR_COMPRS) + errx(1, "unsupported compression algorithm :%d", compr_algo); + v = blk_hdr.flags >> HASH_ALGO_SHIFT; v &= HASH_ALGO_MASK; hash_algo = v; + + if (hash_algo < 0 || hash_algo >= NR_HASHES) + errx(1, "unsupported hash algorithm :%d", hash_algo); } static void