commit 72e411a0ac43390974f08a783aa0332ee9970a00 from: Omar Polo via: Thomas Adam date: Fri Jul 12 06:00:18 2024 UTC ensure we properly zero got_object_id structs ok tobeh@ commit - 331d5cab1036762200ae373029501e82778c2b7e commit + 72e411a0ac43390974f08a783aa0332ee9970a00 blob - 957c494161a4b5571e1dc7c481b20589934974d6 blob + 451756f5b81b90a1f5dc8ab4e5dbf08b76dfe557 --- gotd/session_write.c +++ gotd/session_write.c @@ -696,7 +696,9 @@ update_ref(int *shut, struct gotd_session_client *clie log_debug("updating ref %s for uid %d", refname, client->euid); + memset(&old_id, 0, sizeof(old_id)); memcpy(old_id.sha1, iref.old_id, SHA1_DIGEST_LENGTH); + memset(&new_id, 0, sizeof(new_id)); memcpy(new_id.sha1, iref.new_id, SHA1_DIGEST_LENGTH); err = got_repo_find_object_id(iref.delete_ref ? &old_id : &new_id, repo); blob - 4908999633fa7889a6f84f36e6fcaa39d08bae03 blob + a5bf279dd8b0485b97fbce95976020b75ea6b7a5 --- lib/object_qid.c +++ lib/object_qid.c @@ -31,7 +31,7 @@ const struct got_error * got_object_qid_alloc_partial(struct got_object_qid **qid) { - *qid = malloc(sizeof(**qid)); + *qid = calloc(1, sizeof(**qid)); if (*qid == NULL) return got_error_from_errno("malloc");