The function strncpy was copying an extra character
when i == len (what is possible via revoke interface).

Change-Id: Ic7452da05773e620a1d7bbc55e859c25a86c65f6
Signed-off-by: José Bollo <jose.bo...@open.eurogiciel.org>
Signed-off-by: Stephane Desneux <stephane.desn...@iot.bzh>
---
 security/smack/smack_access.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
1.9.1



--
To unsubscribe from this list: send the line "unsubscribe 
linux-security-module" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to