SMACK: Fix wrong copy size
authorJosé Bollo <jose.bollo@open.eurogiciel.org>
Mon, 15 Sep 2014 09:42:04 +0000 (11:42 +0200)
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>
Wed, 4 Feb 2015 10:23:26 +0000 (11:23 +0100)
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 <jose.bollo@open.eurogiciel.org>
security/smack/smack_access.c

index c062e94..930e548 100644 (file)
@@ -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;