summaryrefslogtreecommitdiff
path: root/sys-process/audit/files/audit-4.0.1-null-deref.patch
diff options
context:
space:
mode:
Diffstat (limited to 'sys-process/audit/files/audit-4.0.1-null-deref.patch')
-rw-r--r--sys-process/audit/files/audit-4.0.1-null-deref.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/sys-process/audit/files/audit-4.0.1-null-deref.patch b/sys-process/audit/files/audit-4.0.1-null-deref.patch
new file mode 100644
index 000000000000..c18322ad2797
--- /dev/null
+++ b/sys-process/audit/files/audit-4.0.1-null-deref.patch
@@ -0,0 +1,35 @@
+From 4780cd1a790286213dda646f782fa7128fb092a9 Mon Sep 17 00:00:00 2001
+From: Yugend <77495782+Yugend@users.noreply.github.com>
+Date: Sat, 4 May 2024 00:39:36 +0300
+Subject: [PATCH] avoiding of NULL pointers dereference (#366)
+
+---
+ src/ausearch-parse.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c
+index 1a5b047f3..be57606bd 100644
+--- a/src/ausearch-parse.c
++++ b/src/ausearch-parse.c
+@@ -719,6 +719,10 @@ static int common_path_parser(search_items *s, char *path)
+ // append
+ snode sn;
+ sn.str = strdup(path);
++ if (sn.str == NULL) {
++ fprintf(stderr, "Out of memory. Check %s file, %d line\n", __FILE__, __LINE__);
++ return 8;
++ }
+ sn.key = NULL;
+ sn.hits = 1;
+ // Attempt to rebuild path if relative
+@@ -1217,6 +1221,10 @@ static int parse_user(const lnode *n, search_items *s, anode *avc)
+ saved = *term;
+ *term = 0;
+ s->hostname = strdup(str);
++ if (s->hostname == NULL) {
++ fprintf(stderr, "Out of memory. Check %s file, %d line\n", __FILE__, __LINE__);
++ return 33;
++ }
+ *term = saved;
+
+ // Lets see if there is something more