Skip to content

Commit

Permalink
Fix UAF in comps_objmrtree_unite function
Browse files Browse the repository at this point in the history
The added field is not used at all in many places and it is probably the
left-over of some copy-paste.
  • Loading branch information
Riccardo Schirone authored and jrohel committed Jan 22, 2019
1 parent d29de45 commit e3a5d05
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 7 deletions.
2 changes: 0 additions & 2 deletions libcomps/src/comps_mradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {
struct Pair {
COMPS_HSList * subnodes;
char * key;
char added;
} *pair, *parent_pair;

pair = malloc(sizeof(struct Pair));
Expand All @@ -195,7 +194,6 @@ void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {
parent_pair = (struct Pair*) it->data;
free(it);

pair->added = 0;
for (it = tmp_subnodes->first; it != NULL; it=it->next) {
pair = malloc(sizeof(struct Pair));
pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;
Expand Down
2 changes: 0 additions & 2 deletions libcomps/src/comps_objmradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {
struct Pair {
COMPS_HSList * subnodes;
char * key;
char added;
} *pair, *parent_pair;

pair = malloc(sizeof(struct Pair));
Expand All @@ -303,7 +302,6 @@ void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {
parent_pair = (struct Pair*) it->data;
free(it);

pair->added = 0;
for (it = tmp_subnodes->first; it != NULL; it=it->next) {
pair = malloc(sizeof(struct Pair));
pair->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes;
Expand Down
2 changes: 0 additions & 2 deletions libcomps/src/comps_objradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@ void comps_objrtree_unite(COMPS_ObjRTree *rt1, COMPS_ObjRTree *rt2) {
struct Pair {
COMPS_HSList * subnodes;
char * key;
char added;
} *pair, *parent_pair;

pair = malloc(sizeof(struct Pair));
Expand All @@ -716,7 +715,6 @@ void comps_objrtree_unite(COMPS_ObjRTree *rt1, COMPS_ObjRTree *rt2) {
//printf("key-part:%s\n", parent_pair->key);
free(it);

//pair->added = 0;
for (it = tmp_subnodes->first; it != NULL; it=it->next) {
pair = malloc(sizeof(struct Pair));
pair->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes;
Expand Down
1 change: 0 additions & 1 deletion libcomps/src/comps_radix.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ void comps_rtree_unite(COMPS_RTree *rt1, COMPS_RTree *rt2) {
struct Pair {
COMPS_HSList * subnodes;
char * key;
char added;
} *pair, *parent_pair;

pair = malloc(sizeof(struct Pair));
Expand Down

0 comments on commit e3a5d05

Please sign in to comment.