From b136f57320d756100d952232ad26b1458ac50733 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 30 Sep 2019 23:50:49 +0300 Subject: [PATCH] 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); Lustre-change: https://review.whamcloud.com/36335 Lustre-commit: 3e2e0025d1e929763f9d4de48746c3433d3684d5 Signed-off-by: Alex Zhuravlev Change-Id: I9f628353c872afc82a582b0a6ca960cd0e8cffcb Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/36482 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/utils/liblustreapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 6112b46..4985294 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1343,6 +1343,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); } -- 1.8.3.1