commit 464ba4b46aabcdf7113057cd8eb6165ecf82d58b from: Omar Polo date: Sun Jul 14 21:18:36 2024 UTC fix a few wrong sizeof() after got_object_id bump commit - 0adc4fa2d86b99cbb48d304a89cd7b5a81c94be6 commit + 464ba4b46aabcdf7113057cd8eb6165ecf82d58b blob - 743f12860b06971ab752a49e3b79f7e3e05fcd65 blob + 62e31cf410ceeeac158da7051a2d01899068b0eb --- lib/object_idset.c +++ lib/object_idset.c @@ -32,6 +32,7 @@ #include "got_error.h" #include "got_lib_delta.h" +#include "got_lib_hash.h" #include "got_lib_inflate.h" #include "got_lib_object.h" #include "got_lib_object_qid.h" @@ -96,7 +97,7 @@ got_object_idset_free(struct got_object_idset *set) static uint64_t idset_hash(struct got_object_idset *set, struct got_object_id *id) { - return SipHash24(&set->key, id->hash, sizeof(id->hash)); + return SipHash24(&set->key, id->hash, got_hash_digest_length(id->algo)); } static const struct got_error * blob - f709a6f1ece7b45517e779175f7eda6b5e6b513c blob + f8b1486958a1d50f30eeb81975bc1f4dd19949b8 --- lib/pack_index.c +++ lib/pack_index.c @@ -267,7 +267,7 @@ read_packed_object(struct got_pack *pack, struct got_i err = got_error_from_errno("read"); break; } - if (n < sizeof(obj->id)) { + if (n < digest_len) { err = got_error(GOT_ERR_BAD_PACKFILE); break; }