Skip to content

Commit ec2c66e

Browse files
[AUTO-CHERRYPICK] Patch apparmor for CVE-2024-31755 - branch main (#9302)
Co-authored-by: Sumynwa <sumsharma@microsoft.com>
1 parent ff0a669 commit ec2c66e

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
commit 7e4d5dabe7a9b754c601f214e65b544e67ba9f59
2+
Author: Up-wind <lj.upwind@gmail.com>
3+
Date: Mon Mar 25 20:07:11 2024 +0800
4+
5+
Add NULL check to cJSON_SetValuestring()
6+
7+
If the valuestring passed to cJSON_SetValuestring is NULL, a null pointer dereference will happen.
8+
9+
This commit adds the NULL check of valuestring before it is dereferenced.
10+
11+
---
12+
binutils/cJSON.c | 5 +++--
13+
1 file changed, 3 insertions(+), 2 deletions(-)
14+
15+
diff --git a/binutils/cJSON.c b/binutils/cJSON.c
16+
index 541934c..e85ac11 100644
17+
--- a/binutils/cJSON.c
18+
+++ b/binutils/cJSON.c
19+
@@ -393,6 +393,7 @@ CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number)
20+
return object->valuedouble = number;
21+
}
22+
23+
+/* Note: when passing a NULL valuestring, cJSON_SetValuestring treats this as an error and return NULL */
24+
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring)
25+
{
26+
char *copy = NULL;
27+
@@ -401,8 +402,8 @@ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring)
28+
{
29+
return NULL;
30+
}
31+
- /* return NULL if the object is corrupted */
32+
- if (object->valuestring == NULL)
33+
+ /* return NULL if the object is corrupted or valuestring is NULL */
34+
+ if (object->valuestring == NULL || valuestring == NULL)
35+
{
36+
return NULL;
37+
}
38+
--
39+
2.25.1
40+

SPECS/apparmor/apparmor.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: AppArmor is an effective and easy-to-use Linux application security system.
22
Name: apparmor
33
Version: 3.0.4
4-
Release: 3%{?dist}
4+
Release: 4%{?dist}
55
License: GPLv2
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -10,6 +10,7 @@ URL: https://launchpad.net/apparmor
1010
Source0: https://launchpad.net/apparmor/3.0/3.0.4/+download/%{name}-%{version}.tar.gz
1111
Patch1: apparmor-service-start-fix.patch
1212
Patch2: CVE-2023-50471.patch
13+
Patch3: CVE-2024-31755.patch
1314
# CVE-2016-1585 has no upstream fix as of 2020/09/28
1415
Patch100: CVE-2016-1585.nopatch
1516
BuildRequires: apr
@@ -354,6 +355,9 @@ make DESTDIR=%{buildroot} install
354355
%exclude %{perl_archlib}/perllocal.pod
355356

356357
%changelog
358+
* Thu May 30 2024 Sumedh Sharma <sumsharma@microsoft.com> - 3.0.4-4
359+
- Add patch for CVE-2024-31755
360+
357361
* Wed Dec 27 2023 Dallas Delaney <dadelan@microsoft.com> - 3.0.4-3
358362
- Add patch for CVE-2023-50471 and CVE-2023-50472
359363

0 commit comments

Comments
 (0)