提交 0c1b9970 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

staging: lustre: lustre: Off by two in lmv_fid2path()

We want to concatonate join string one, a '/' character, string two and
then a NUL terminator.  The destination buffer holds ori_gf->gf_pathlen
characters.  The strlen() function returns the number of characters not
counting the NUL terminator.  So we should be adding two extra spaces,
one for the foward slash and one for the NUL.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: Nfrank zago <fzago@cray.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 5e47adb9
......@@ -635,8 +635,8 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg,
char *ptr;
ori_gf = karg;
if (strlen(ori_gf->gf_path) +
strlen(gf->gf_path) > ori_gf->gf_pathlen) {
if (strlen(ori_gf->gf_path) + 1 +
strlen(gf->gf_path) + 1 > ori_gf->gf_pathlen) {
rc = -EOVERFLOW;
goto out_fid2path;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册