From 3bb10ea3e6c0d27dfcd9257f86640435cb6d47d6 Mon Sep 17 00:00:00 2001 From: Nathan Owens Date: Wed, 4 Dec 2019 16:44:03 -0600 Subject: [PATCH] audit: add memory leak patches Signed-off-by: Nathan Owens --- ...uparse-caused-by-corrected-event-ord.patch | 31 ++++++++++++++ ...uparse-caused-by-corrected-event-ord.patch | 41 +++++++++++++++++++ srcpkgs/audit/template | 2 +- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/audit/patches/0001-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch create mode 100644 srcpkgs/audit/patches/0002-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch diff --git a/srcpkgs/audit/patches/0001-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch b/srcpkgs/audit/patches/0001-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch new file mode 100644 index 00000000000..0c2b320bb0a --- /dev/null +++ b/srcpkgs/audit/patches/0001-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch @@ -0,0 +1,31 @@ +From c2544c220bb1b1045589ceae3dbb69f195b860e5 Mon Sep 17 00:00:00 2001 +From: Steve Grubb +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 auparse/auparse.c auparse/auparse.c +index 34aa90c..ecea88e 100644 +--- auparse/auparse.c ++++ auparse/auparse.c +@@ -265,6 +265,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]; + } + } +-- +2.24.0 + diff --git a/srcpkgs/audit/patches/0002-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch b/srcpkgs/audit/patches/0002-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch new file mode 100644 index 00000000000..ed6a8991131 --- /dev/null +++ b/srcpkgs/audit/patches/0002-Fix-memleak-in-auparse-caused-by-corrected-event-ord.patch @@ -0,0 +1,41 @@ +From ce0debf94f93d787d3bed635952133b2a5ff3551 Mon Sep 17 00:00:00 2001 +From: Steve Grubb +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 auparse/auparse.c auparse/auparse.c +index ecea88e..5318d25 100644 +--- auparse/auparse.c ++++ auparse/auparse.c +@@ -259,23 +259,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; + } + +-- +2.24.0 + diff --git a/srcpkgs/audit/template b/srcpkgs/audit/template index c624aae0f6d..3e0d21784c0 100644 --- a/srcpkgs/audit/template +++ b/srcpkgs/audit/template @@ -1,7 +1,7 @@ # Template file for 'audit' pkgname=audit version=2.8.5 -revision=1 +revision=2 build_style=gnu-configure configure_args="--libdir=/usr/lib --enable-shared=audit --enable-gssapi-krb5 --with-apparmor --with-libcap-ng --with-python3"