audit/backport-last-part-of-NULL-pointer-checks.patch
xuraoqing 952d9bf9ef backport patches to fix bug
Signed-off-by: xuraoqing <xuraoqing@huawei.com>
2024-05-28 14:16:46 +08:00

46 lines
1.2 KiB
Diff

From 97f3c78b6b31126c1128927d9c85bb794a1efa17 Mon Sep 17 00:00:00 2001
From: Yugend <jugendd@mail.ru>
Date: Fri, 15 Mar 2024 18:13:36 +0300
Subject: [PATCH] last part of NULL pointer checks
Conflict:NA
Reference:https://github.com/linux-audit/audit-userspace/commit/97f3c78b6b31126c1128927d9c85bb794a1efa17
---
auparse/interpret.c | 3 +++
src/ausearch-lookup.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/auparse/interpret.c b/auparse/interpret.c
index 12ae35e2..f6f39449 100644
--- a/auparse/interpret.c
+++ b/auparse/interpret.c
@@ -420,6 +420,9 @@ int load_interpretation_list(const char *buffer)
il.cnt = 0;
il.record = buf = strdup(buffer);
+ if (buf == NULL) {
+ goto err_out;
+ }
if (strncmp(buf, "SADDR=", 6) == 0) {
// We have SOCKADDR record. It has no other values.
// Handle it by itself.
diff --git a/src/ausearch-lookup.c b/src/ausearch-lookup.c
index bdcd7aaf..86239f39 100644
--- a/src/ausearch-lookup.c
+++ b/src/ausearch-lookup.c
@@ -302,6 +302,10 @@ char *unescape(const char *buf)
return NULL;
str = strndup(buf, ptr - buf);
+ if (str == NULL) {
+ fprintf(stderr, "Memory alocation error");
+ return NULL;
+ }
if (*buf == '(')
return str;
--
2.33.0