dedup

deduplicating backup program
git clone git://git.2f30.org/dedup
Log | Files | Refs | README | LICENSE

commit 874e674f9ffc61d83ff6e756d9749d4ae9d1129b
parent 738efabad162925277a2e7bb809ea127fd75d497
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:
Mdedup.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

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