audit/Fix-memleak-in-auparse-caused-by-corrected-event-ordering.patch
2019-09-30 10:31:51 -04:00

68 lines
2.0 KiB
Diff

From 1af601fed7c23849ae50cacf0eff15fa7dc781a8 Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Tue, 26 Mar 2019 09:18:00 -0400
Subject: [PATCH 1/2] Fix memleak in auparse caused by corrected event ordering
---
auparse/auparse.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/auparse/auparse.c b/auparse/auparse.c
index 042ea2b..af5dc7b 100644
--- a/auparse/auparse.c
+++ b/auparse/auparse.c
@@ -266,6 +266,14 @@ static event_list_t *au_get_ready_event(auparse_state_t *au, int is_test)
au_lolnode *ptr = lowest;
while (ptr->status == EBS_EMPTY && lol->maxi > 0) {
lol->maxi--;
+ if (ptr->l) {
+ aup_list_clear(ptr->l);
+ free(ptr->l);
+ ptr->l = NULL;
+ au->le = NULL; // this should crash
+ // usage of au->le
+ // until reset
+ }
ptr = &lol->array[lol->maxi];
}
}
From a4ed2001dd9db902764256ee08bd53e2039f217e Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Tue, 26 Mar 2019 17:24:37 -0400
Subject: [PATCH 2/2] Fix memleak in auparse caused by corrected event ordering
part 2
---
auparse/auparse.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/auparse/auparse.c b/auparse/auparse.c
index af5dc7b..7662b85 100644
--- a/auparse/auparse.c
+++ b/auparse/auparse.c
@@ -260,23 +260,6 @@ static event_list_t *au_get_ready_event(auparse_state_t *au, int is_test)
if (lowest && lowest->status == EBS_COMPLETE) {
lowest->status = EBS_EMPTY;
au->au_ready--;
- // Try to consolidate the array so that we iterate
- // over a smaller portion next time
- if (lowest == &lol->array[lol->maxi]) {
- au_lolnode *ptr = lowest;
- while (ptr->status == EBS_EMPTY && lol->maxi > 0) {
- lol->maxi--;
- if (ptr->l) {
- aup_list_clear(ptr->l);
- free(ptr->l);
- ptr->l = NULL;
- au->le = NULL; // this should crash
- // usage of au->le
- // until reset
- }
- ptr = &lol->array[lol->maxi];
- }
- }
return lowest->l;
}