From: Alex Zhuravlev Date: Mon, 30 Sep 2019 20:50:49 +0000 (+0300) Subject: LU-12703 utils: reset rootpath in llapi_search_rootpath() X-Git-Tag: 2.12.90~27 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F36335%2F4;p=fs%2Flustre-release.git LU-12703 utils: reset rootpath in llapi_search_rootpath() as get_root_path() can use it as a source and fail if passed pathname contains garbage (on stack); Signed-off-by: Alex Zhuravlev Change-Id: I9f628353c872afc82a582b0a6ca960cd0e8cffcb Reviewed-on: https://review.whamcloud.com/36335 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 3417c77..848a72d 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1454,6 +1454,9 @@ int llapi_search_fsname(const char *pathname, char *fsname) int llapi_search_rootpath(char *pathname, const char *fsname) { + /* pathname can be used as an argument by get_root_path(), + * clear it for safety */ + pathname[0] = 0; return get_root_path(WANT_PATH, (char *)fsname, NULL, pathname, -1); }