summaryrefslogtreecommitdiffstats
path: root/lib/ismounted.c
diff options
context:
space:
mode:
authorKarel Zak2014-07-01 13:51:32 +0200
committerKarel Zak2014-07-01 13:51:32 +0200
commitf3135f939d9530c44c8c86a8e408f1d60ca83c0e (patch)
tree4779730c5fda1f1947b9a16f7fe9b19b1bb2bb49 /lib/ismounted.c
parentfsck: uninitialized argument value [clang-analyze] (diff)
downloadkernel-qcow2-util-linux-f3135f939d9530c44c8c86a8e408f1d60ca83c0e.tar.gz
kernel-qcow2-util-linux-f3135f939d9530c44c8c86a8e408f1d60ca83c0e.tar.xz
kernel-qcow2-util-linux-f3135f939d9530c44c8c86a8e408f1d60ca83c0e.zip
lib/ismounted: more robust buffer usage [clang-analyze]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/ismounted.c')
-rw-r--r--lib/ismounted.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ismounted.c b/lib/ismounted.c
index 2463f3356..8a882b27e 100644
--- a/lib/ismounted.c
+++ b/lib/ismounted.c
@@ -317,7 +317,8 @@ int check_mount_point(const char *device, int *mount_flags,
if (is_swap_device(device)) {
*mount_flags = MF_MOUNTED | MF_SWAP;
- strncpy(mtpt, "<swap>", mtlen);
+ if (mtpt && mtlen)
+ strncpy(mtpt, "<swap>", mtlen);
} else {
#ifdef HAVE_MNTENT_H
retval = check_mntent(device, mount_flags, mtpt, mtlen);