diff options
author | Gerald Schaefer <gerald.schaefer@de.ibm.com> | 2013-02-26 14:33:54 +0100 |
---|---|---|
committer | Eric Munson <emunson@bert.(none)> | 2013-03-03 18:39:25 -0500 |
commit | 7caefa7221c5b09bc5a9f77e715807bcc85fdfba (patch) | |
tree | c896b752a1640c0e495443b4069ad92c91fad829 | |
parent | ee00e3102ec8354175b2ce99eb5350d7026fd67c (diff) | |
download | libhugetlbfs-7caefa7221c5b09bc5a9f77e715807bcc85fdfba.tar.gz |
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 <v.mayatskih@gmail.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Eric B Munson <emunson@mgebm.net>
-rw-r--r-- | hugeutils.c | 1 |
1 files changed, 1 insertions, 0 deletions
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); |