DO NOT MERGE - f2fs-tools: do sanity check on xattr entry

If there are corrupted xattr entries in xattr space, it may cause
traversing across end of xattr space issue, this patch adds sanity
check during xattr traverse to avoid such issue.

This patch synchronizes kernel commits:

2777e654371d ("f2fs: fix to avoid accessing xattr across the boundary")
688078e7f36c ("f2fs: fix to avoid memory leakage in f2fs_listxattr")

Bug: 305658663
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c208057ce971b24990fb6bd1fee7e39b90ee796e)
Merged-In: Ib481ef79f4e0498098559f58066bcb6367d4de29
Change-Id: Ib481ef79f4e0498098559f58066bcb6367d4de29
4 files changed