From: José Bollo Date: Mon, 15 Sep 2014 09:42:04 +0000 (+0200) Subject: SMACK: Fix wrong copy size X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5220ab04dc44e3b8b6c2d5789d27a89906efbe5e;p=platform%2Fkernel%2Flinux-stable.git SMACK: Fix wrong copy size The function strncpy was copying an extra character 9 when i == len (what is possible via revoke interface). Change-Id: Ic7452da05773e620a1d7bbc55e859c25a86c65f6 Signed-off-by: José Bollo --- diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index c062e94..930e548 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c @@ -432,7 +432,7 @@ char *smk_parse_smack(const char *string, int len) smack = kzalloc(i + 1, GFP_KERNEL); if (smack != NULL) { - strncpy(smack, string, i + 1); + strncpy(smack, string, i); smack[i] = '\0'; } return smack;