From: Jarkko Sakkinen Date: Tue, 8 Oct 2013 13:17:23 +0000 (+0300) Subject: Fix: allow CIPSO labels with zero categories X-Git-Tag: v1.1.0~62 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e4ea9142727ca7f14bf1d64cd81949b28bb1d0b;p=platform%2Fupstream%2Fsmack.git Fix: allow CIPSO labels with zero categories There was false restriction in smack_cipso_add_from_file() that disallowed CIPSO labels without categories. For example, this example given in the SMACK kernel documentation should be perfectly legal: TopSecret 7 --- diff --git a/libsmack/libsmack.c b/libsmack/libsmack.c index ac58dd2..1adc68e 100644 --- a/libsmack/libsmack.c +++ b/libsmack/libsmack.c @@ -437,7 +437,7 @@ int smack_cipso_add_from_file(struct smack_cipso *cipso, int fd) label = strtok_r(buf, " \t\n", &ptr); level = strtok_r(NULL, " \t\n", &ptr); cat = strtok_r(NULL, " \t\n", &ptr); - if (label == NULL || cat == NULL || level == NULL || + if (label == NULL || level == NULL || strlen(label) > SMACK_LABEL_LEN) { errno = EINVAL; goto err_out;