Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/
Date: Wed, 30 Nov 2016 22:49:10
Message-Id: 1479405792.6414c3bc394f86a5d6a5f02c934469e21bbbc923.williamh@OpenRC
1 commit: 6414c3bc394f86a5d6a5f02c934469e21bbbc923
2 Author: Jason Zaman <jason <AT> perfinion <DOT> com>
3 AuthorDate: Wed Nov 16 04:55:49 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 17 18:03:12 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6414c3bc
7
8 selinux: fix SIGSEGV with invalid contexts
9
10 Fixes: https://github.com/openrc/openrc/issues/104
11
12 src/rc/rc-selinux.c | 14 +++++++++++++-
13 1 file changed, 13 insertions(+), 1 deletion(-)
14
15 diff --git a/src/rc/rc-selinux.c b/src/rc/rc-selinux.c
16 index a792fe2..2eb631a 100644
17 --- a/src/rc/rc-selinux.c
18 +++ b/src/rc/rc-selinux.c
19 @@ -334,7 +334,19 @@ void selinux_setup(char **argv)
20
21 /* extract the type from the context */
22 curr_con = context_new(curr_context);
23 - curr_t = xstrdup(context_type_get(curr_con));
24 + if (!curr_con) {
25 + free(curr_context);
26 + goto out;
27 + }
28 +
29 + curr_t = context_type_get(curr_con);
30 + if (!curr_t) {
31 + context_free(curr_con);
32 + free(curr_context);
33 + goto out;
34 + }
35 +
36 + curr_t = xstrdup(curr_t);
37 /* dont need them anymore so free() now */
38 context_free(curr_con);
39 free(curr_context);