summaryrefslogtreecommitdiffstats
path: root/libmount/src/utils.c
diff options
context:
space:
mode:
authorKarel Zak2012-06-15 12:26:05 +0200
committerKarel Zak2012-06-15 12:26:05 +0200
commit9d670a2ab4b5b6d5a19aa4d392353f64b7218a5b (patch)
treef36547dd53f32a83799e129bdb633ed190beb452 /libmount/src/utils.c
parentlibmount: fix trivial typos (diff)
downloadkernel-qcow2-util-linux-9d670a2ab4b5b6d5a19aa4d392353f64b7218a5b.tar.gz
kernel-qcow2-util-linux-9d670a2ab4b5b6d5a19aa4d392353f64b7218a5b.tar.xz
kernel-qcow2-util-linux-9d670a2ab4b5b6d5a19aa4d392353f64b7218a5b.zip
libmount: make some string operations more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/utils.c')
-rw-r--r--libmount/src/utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index d4cc0b3ed..63d1079d0 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -839,7 +839,8 @@ char *mnt_get_mountpoint(const char *path)
goto err;
dir = st.st_dev;
if (dir != base) {
- *(p - 1) = '/';
+ if (p > mnt)
+ *(p - 1) = '/';
goto done;
}
base = dir;