summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-10-21 17:44:26 -0400
committerPaul Moore <pmoore@redhat.com>2015-10-21 17:44:26 -0400
commitaa736c36db3e583d249e1d23a3ac9223b1c55f95 (patch)
tree52d40162fdeafd2b1bb4c51127416ca5ef71107a
parent20ba96aeebd40f09a1d626913235941e290992c7 (diff)
downloadop-kernel-dev-aa736c36db3e583d249e1d23a3ac9223b1c55f95.zip
op-kernel-dev-aa736c36db3e583d249e1d23a3ac9223b1c55f95.tar.gz
selinux: use kmemdup in security_sid_to_context_core()
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r--security/selinux/ss/services.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index c550df0..994c824 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1259,12 +1259,12 @@ static int security_sid_to_context_core(u32 sid, char **scontext,
*scontext_len = strlen(initial_sid_to_string[sid]) + 1;
if (!scontext)
goto out;
- scontextp = kmalloc(*scontext_len, GFP_ATOMIC);
+ scontextp = kmemdup(initial_sid_to_string[sid],
+ *scontext_len, GFP_ATOMIC);
if (!scontextp) {
rc = -ENOMEM;
goto out;
}
- strcpy(scontextp, initial_sid_to_string[sid]);
*scontext = scontextp;
goto out;
}
OpenPOWER on IntegriCloud