lkml.org 
[lkml]   [2015]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/5] selinux: use kmemdup in security_sid_to_context_core()
From
Date
On 09/25/2015 06:34 PM, Rasmus Villemoes wrote:
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>

> ---
> security/selinux/ss/services.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> index c550df0e0ff1..994c824a34c6 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;
> }
>



\
 
 \ /
  Last update: 2015-09-29 20:41    [W:0.108 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site