chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3e88347
)
selinux: fix potential double free crash in child process
author
Michal Sekletar
<msekleta@redhat.com>
Mon, 13 Oct 2014 13:25:09 +0000
(15:25 +0200)
committer
Michal Sekletar
<msekleta@redhat.com>
Wed, 15 Oct 2014 08:58:27 +0000
(10:58 +0200)
Before returning from function we should reset ret to NULL, thus cleanup
function is nop.
Also context_str() returns pointer to a string containing context but not a
copy, hence we must make copy it explicitly.
src/shared/label.c
patch
|
blob
|
history
diff --git
a/src/shared/label.c
b/src/shared/label.c
index b6af38d82d39a0940c6133c4ca886d7384c59cdb..69d4616183b3bf4dcdb04e5bfde8a137384bd35f 100644
(file)
--- a/
src/shared/label.c
+++ b/
src/shared/label.c
@@
-334,7
+334,7
@@
int label_get_child_mls_label(int socket_fd, const char *exe, char **label) {
}
freecon(mycon);
- mycon =
context_str(bcon
);
+ mycon =
strdup(context_str(bcon)
);
if (!mycon) {
r = -errno;
goto out;
@@
-348,6
+348,7
@@
int label_get_child_mls_label(int socket_fd, const char *exe, char **label) {
}
*label = ret;
+ ret = NULL;
r = 0;
out: