-
Notifications
You must be signed in to change notification settings - Fork 1
/
polkit-0.96-CVE-2021-4034.patch
42 lines (39 loc) · 1.2 KB
/
polkit-0.96-CVE-2021-4034.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
diff -uNr polkit-0.96/src/programs/pkcheck.c polkit-0.96-new/src/programs/pkcheck.c
--- polkit-0.96/src/programs/pkcheck.c 2022-01-29 13:32:17.257066474 +0800
+++ polkit-0.96-new/src/programs/pkcheck.c 2022-01-29 14:21:03.381476709 +0800
@@ -96,6 +96,8 @@
allow_user_interaction = FALSE;
ret = 126;
+ if (argc < 1) { exit(126); }
+
g_type_init ();
details = polkit_details_new ();
diff -uNr polkit-0.96/src/programs/pkexec.c polkit-0.96-new/src/programs/pkexec.c
--- polkit-0.96/src/programs/pkexec.c 2022-01-29 13:32:17.245066321 +0800
+++ polkit-0.96-new/src/programs/pkexec.c 2022-01-29 14:21:48.298050805 +0800
@@ -415,6 +415,8 @@
gchar *opt_user;
pid_t pid_of_caller;
+ if (argc < 1) { exit(127); }
+
ret = 127;
authority = NULL;
subject = NULL;
@@ -520,7 +522,16 @@
goto out;
}
g_free (path);
- argv[n] = path = s;
+
+ path = s;
+
+ /* argc<2 and pkexec runs just shell, argv is guaranteed to be null-terminated.
+ * /-less shell shouldn't happen, but let's be defensive and don't write to null-termination
+ */
+ if (argv[n] != NULL)
+ {
+ argv[n] = path;
+ }
}
if (access (path, F_OK) != 0)
{