]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitcf75119d2f9b8116b2af10a78ada658a34a83151
tree8e7a067fbf6b4d8b55d3ee1f336d731d172520fb
parentaa8e0a3322846939e125ae5893aadf87e515f6c3
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: 967e31b54904 ("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