commit 0ae61b79f6344b7913b8daf346b41b4e3fe8211a from: Stefan Sperling date: Mon Mar 21 10:17:40 2022 UTC fix potential NULL deref in error path of got_object_idset_remove() commit - 7a30b5cb05817b97fcb91183049b629a948e3ba6 commit + 0ae61b79f6344b7913b8daf346b41b4e3fe8211a blob - bec28e2592f77e2e43e9df547016ff61d8886b42 blob + 37ea8e262784f9521e53f7db7f9ff11232dce3d6 --- lib/object_idset.c +++ lib/object_idset.c @@ -145,12 +145,15 @@ got_object_idset_remove(void **data, struct got_object if (set->totelem == 0) return got_error(GOT_ERR_NO_OBJ); - if (id == NULL) + if (id == NULL) { entry = RB_ROOT(&set->entries); - else + if (entry == NULL) + return got_error(GOT_ERR_NO_OBJ); + } else { entry = find_element(set, id); - if (entry == NULL) - return got_error_no_obj(id); + if (entry == NULL) + return got_error_no_obj(id); + } RB_REMOVE(got_object_idset_tree, &set->entries, entry); if (data)