Add smack_label_length() function
authorJanusz Kozerski <j.kozerski@samsung.com>
Wed, 2 Oct 2013 07:52:23 +0000 (09:52 +0200)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Fri, 25 Oct 2013 12:37:07 +0000 (15:37 +0300)
commit4ade9ddd84d3155ec318edc13a48726ead2c7c02
treefde10857e34c9fa9349b679860ed567588944574
parent72ef04e318607567bb60bcf4f534c859cd7b572c
Add smack_label_length() function

Kernel does not validate the Smack label - instead the label will be
cut on the first incorrect character (after parsing at least one
correct character).

This function gives the user possibility to verify the correctness
of the Smack label before use and calculate labels length.

Additionally, all string length calculations are replaces with this
function to make implementation safer.

[jarkko.sakkinen@linux.intel.com:
 did some modifications:
 - smack_is_label_valid() -> smack_label_length()
 - libsmack.c:
   * return length
   * loop invariant had off-by-one error
   * cosmetic: "++i" not "i++"
 - libsmack.h:
   * updated documentation
   * cosmetic: formatting errors in  @param and @return]
(cherry picked from commit 8b083a8c67219c5d1dbfbf2ad1082c1954f9c9fa)
doc/Makefile.am
doc/smack_have_access.3
doc/smack_label_length.3 [new file with mode: 0644]
libsmack/libsmack.c
libsmack/libsmack.sym
libsmack/sys/smack.h