smack-team/smack — pull request #31 by jarkkos (2013-10-24 12:59:34+00:00)
Title: 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]