Signed-off-by: wzt <wzt...@gmail.com>
Cc: Jmorris <jmo...@namei.org>
diff --git a/security/smack/smack.h b/security/smack/smack.h
index c6e9aca..600474b 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -109,7 +109,7 @@ struct smk_netlbladdr {
*/
struct smack_known {
struct list_head list;
- char smk_known[SMK_LABELLEN];
+ char smk_known[SMK_LABELLEN + 1]; /*
smk_known + \0 */
u32 smk_secid;
struct smack_cipso *smk_cipso;
spinlock_t smk_cipsolock; /* for changing cipso map */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
James Morris
<jmo...@namei.org>
SMK_LABELLEN is already SMK_MAXLEN+1. That's why the strncpy() above
uses SMK_MAXLEN, so that maximum copied will be SMK_MAXLEN+1, including
the trailing '\0'. The only possible case it could miss would be a
label that is SMK_LABELLEN (24 bytes) long, and that would be an error
because Smack labels are limited to SMK_MAXLEN (23 bytes) plus the
trailing '\0'. The strncpy() could easily be strcpy(), as only labels
that have been imported or hand crafted in the code will be in "from".
>> u32 smk_secid;
>> struct smack_cipso *smk_cipso;
>> spinlock_t smk_cipsolock; /* for changing cipso map */
>>
>>
--