With the 'encrypted' key type it was possible for userspace to provide adata blob ending with a master key description shorter than expected,e.g. 'keyctl add encrypted desc "new x" @s'. When validating such amaster key description, validate_master_desc() could read beyond the endof the buffer. Fix this by using strncmp() instead of memcmp(). [Alsoclean up the code to deduplicate some logic.]