orangefs: off by ones in xattr size checks
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 22 May 2017 12:08:31 +0000 (15:08 +0300)
committerMike Marshall <hubcap@omnibond.com>
Thu, 14 Sep 2017 18:58:27 +0000 (14:58 -0400)
commit5f13e58767a53ebb54265e03c0c4a67650286263
tree8e7a067fbf6b4d8b55d3ee1f336d731d172520fb
parentba5e79ea183a2b809a9bbd2f8d76dc69ca32a92b
orangefs: off by ones in xattr size checks

A previous patch which claimed to remove off by ones actually introduced
them.

strlen() returns the length of the string not including the NUL
character.  We are using strcpy() to copy "name" into a buffer which is
ORANGEFS_MAX_XATTR_NAMELEN characters long.  We should make sure to
leave space for the NUL, otherwise we're writing one character beyond
the end of the buffer.

Fixes: e675c5ec51fe ("orangefs: clean up oversize xattr validation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/xattr.c