From 7caefa7221c5b09bc5a9f77e715807bcc85fdfba Mon Sep 17 00:00:00 2001 From: Gerald Schaefer Date: Tue, 26 Feb 2013 14:33:54 +0100 Subject: Terminate path with '\0' in find_mounts() commit 8c075e33 introduced a regression. The previous sscanf() implicitly did a null termination on path, while the new code misses the null termination. This can result in a failing hugetlbfs_test_path() and an error message like: "libhugetlbfs: WARNING: Hugepage size 1048576 unavailable" Reported-by: Vitaly Mayatskih Signed-off-by: Gerald Schaefer Signed-off-by: Eric B Munson --- hugeutils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hugeutils.c b/hugeutils.c index 6a4dc85..53a7fbd 100644 --- a/hugeutils.c +++ b/hugeutils.c @@ -665,6 +665,7 @@ static void find_mounts(void) continue; strncpy(path, match, end - match); + path[end - match] = '\0'; if ((hugetlbfs_test_path(path) == 1) && !(access(path, R_OK | W_OK | X_OK))) add_hugetlbfs_mount(path, 0); -- cgit v1.2.1