Commit aa736c36 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Paul Moore

selinux: use kmemdup in security_sid_to_context_core()

Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
parent 20ba96ae
...@@ -1259,12 +1259,12 @@ static int security_sid_to_context_core(u32 sid, char **scontext, ...@@ -1259,12 +1259,12 @@ static int security_sid_to_context_core(u32 sid, char **scontext,
*scontext_len = strlen(initial_sid_to_string[sid]) + 1; *scontext_len = strlen(initial_sid_to_string[sid]) + 1;
if (!scontext) if (!scontext)
goto out; goto out;
scontextp = kmalloc(*scontext_len, GFP_ATOMIC); scontextp = kmemdup(initial_sid_to_string[sid],
*scontext_len, GFP_ATOMIC);
if (!scontextp) { if (!scontextp) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
strcpy(scontextp, initial_sid_to_string[sid]);
*scontext = scontextp; *scontext = scontextp;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment