libsmack: early fail in accesses_apply() if modify rules are not supported

In accesses_apply(), in the beginning of each iteration, check
that change_fd is a valid file descriptor if the current rule
is a modify rule. Return with -1 immediately if that is not the
case.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
libsmack: check in accesses_apply() that rule fits into buffer

It should be that parsed rules fit with in boundaries. However,
it's good to add a sanity check because we get it for free here.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
libsmack: remove redundant strlen() call from accesses_apply()

Return value of snprintf() should give the same length as strlen()
would given that string fits into buffer.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
libsmack: remove redundant check for clear flag form accesses_apply()

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
libsmack: check against the correct length in accesses_apply()

accesses_apply() does not check that the length of the data written
can be properly loaded. This patch adds check for the correct range
for long labels, modify labels and short labels.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>