Blame SOURCES/0001-Fix-UAF-in-comps_objmrtree_unite-function.patch

70bab7
From e3a5d056633677959ad924a51758876d415e7046 Mon Sep 17 00:00:00 2001
70bab7
From: Riccardo Schirone <rschiron@redhat.com>
70bab7
Date: Mon, 21 Jan 2019 18:11:42 +0100
70bab7
Subject: [PATCH] Fix UAF in comps_objmrtree_unite function
70bab7
70bab7
The added field is not used at all in many places and it is probably the
70bab7
left-over of some copy-paste.
70bab7
---
70bab7
 libcomps/src/comps_mradix.c    | 2 --
70bab7
 libcomps/src/comps_objmradix.c | 2 --
70bab7
 libcomps/src/comps_objradix.c  | 2 --
70bab7
 libcomps/src/comps_radix.c     | 1 -
70bab7
 4 files changed, 7 deletions(-)
70bab7
70bab7
diff --git a/libcomps/src/comps_mradix.c b/libcomps/src/comps_mradix.c
70bab7
index 8ef9640..dfdee8e 100644
70bab7
--- a/libcomps/src/comps_mradix.c
70bab7
+++ b/libcomps/src/comps_mradix.c
70bab7
@@ -177,7 +177,6 @@ void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {
70bab7
     struct Pair {
70bab7
         COMPS_HSList * subnodes;
70bab7
         char * key;
70bab7
-        char added;
70bab7
     } *pair, *parent_pair;
70bab7
 
70bab7
     pair = malloc(sizeof(struct Pair));
70bab7
@@ -195,7 +194,6 @@ void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {
70bab7
         parent_pair = (struct Pair*) it->data;
70bab7
         free(it);
70bab7
 
70bab7
-        pair->added = 0;
70bab7
         for (it = tmp_subnodes->first; it != NULL; it=it->next) {
70bab7
             pair = malloc(sizeof(struct Pair));
70bab7
             pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;
70bab7
diff --git a/libcomps/src/comps_objmradix.c b/libcomps/src/comps_objmradix.c
70bab7
index 9a2038b..22ad262 100644
70bab7
--- a/libcomps/src/comps_objmradix.c
70bab7
+++ b/libcomps/src/comps_objmradix.c
70bab7
@@ -285,7 +285,6 @@ void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {
70bab7
     struct Pair {
70bab7
         COMPS_HSList * subnodes;
70bab7
         char * key;
70bab7
-        char added;
70bab7
     } *pair, *parent_pair;
70bab7
 
70bab7
     pair = malloc(sizeof(struct Pair));
70bab7
@@ -303,7 +302,6 @@ void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {
70bab7
         parent_pair = (struct Pair*) it->data;
70bab7
         free(it);
70bab7
 
70bab7
-        pair->added = 0;
70bab7
         for (it = tmp_subnodes->first; it != NULL; it=it->next) {
70bab7
             pair = malloc(sizeof(struct Pair));
70bab7
             pair->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes;
70bab7
diff --git a/libcomps/src/comps_objradix.c b/libcomps/src/comps_objradix.c
70bab7
index c657b75..840592a 100644
70bab7
--- a/libcomps/src/comps_objradix.c
70bab7
+++ b/libcomps/src/comps_objradix.c
70bab7
@@ -697,7 +697,6 @@ void comps_objrtree_unite(COMPS_ObjRTree *rt1, COMPS_ObjRTree *rt2) {
70bab7
     struct Pair {
70bab7
         COMPS_HSList * subnodes;
70bab7
         char * key;
70bab7
-        char added;
70bab7
     } *pair, *parent_pair;
70bab7
 
70bab7
     pair = malloc(sizeof(struct Pair));
70bab7
@@ -716,7 +715,6 @@ void comps_objrtree_unite(COMPS_ObjRTree *rt1, COMPS_ObjRTree *rt2) {
70bab7
         //printf("key-part:%s\n", parent_pair->key);
70bab7
         free(it);
70bab7
 
70bab7
-        //pair->added = 0;
70bab7
         for (it = tmp_subnodes->first; it != NULL; it=it->next) {
70bab7
             pair = malloc(sizeof(struct Pair));
70bab7
             pair->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes;
70bab7
diff --git a/libcomps/src/comps_radix.c b/libcomps/src/comps_radix.c
70bab7
index ada4fda..05dcaf2 100644
70bab7
--- a/libcomps/src/comps_radix.c
70bab7
+++ b/libcomps/src/comps_radix.c
70bab7
@@ -529,7 +529,6 @@ void comps_rtree_unite(COMPS_RTree *rt1, COMPS_RTree *rt2) {
70bab7
     struct Pair {
70bab7
         COMPS_HSList * subnodes;
70bab7
         char * key;
70bab7
-        char added;
70bab7
     } *pair, *parent_pair;
70bab7
 
70bab7
     pair = malloc(sizeof(struct Pair));
70bab7
--
70bab7
libgit2 0.28.2
70bab7