Commit 237cfda12ceeaf6741ae34b166118631ffd35a80

Stefan Sperling 2021-10-08T22:34:25

make got_repo_match_object_id() filter tags by the requested object type Potentially this function could return objects of a type that was not requested. Problem found by code inspection. This change does not affect any of our existing tests.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/repository.c b/lib/repository.c
index aefced9..b06c9dd 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -1505,7 +1505,7 @@ got_repo_match_object_id(struct got_object_id **id, char **label,
 		*label = NULL;
 
 	if (refs) {
-		err = got_repo_object_match_tag(&tag, id_str, GOT_OBJ_TYPE_ANY,
+		err = got_repo_object_match_tag(&tag, id_str, obj_type,
 		    refs, repo);
 		if (err == NULL) {
 			*id = got_object_id_dup(