|
|
688916 |
From cbcf65c6518652242aab6960eeb983c6bc771bd3 Mon Sep 17 00:00:00 2001
|
|
|
688916 |
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
|
688916 |
Date: Sun, 12 Feb 2023 19:23:12 +0100
|
|
|
688916 |
Subject: [PATCH] filesystem: use PATH_MAX for linux paths
|
|
|
688916 |
|
|
|
688916 |
(cherry picked from commit cf0dc9a13cf365859e7dad3bb1ad02040925ae11)
|
|
|
688916 |
---
|
|
|
688916 |
lib/device/filesystem.c | 12 ++++++------
|
|
|
688916 |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
688916 |
|
|
|
688916 |
diff --git a/lib/device/filesystem.c b/lib/device/filesystem.c
|
|
|
688916 |
index db507bdda..0c902ec14 100644
|
|
|
688916 |
--- a/lib/device/filesystem.c
|
|
|
688916 |
+++ b/lib/device/filesystem.c
|
|
|
688916 |
@@ -219,10 +219,10 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
|
|
|
688916 |
FILE *fp;
|
|
|
688916 |
char proc_line[PATH_MAX];
|
|
|
688916 |
char proc_fstype[FSTYPE_MAX];
|
|
|
688916 |
- char proc_devpath[1024];
|
|
|
688916 |
- char proc_mntpath[1024];
|
|
|
688916 |
- char lv_mapper_path[1024];
|
|
|
688916 |
- char mntent_mount_dir[1024];
|
|
|
688916 |
+ char proc_devpath[PATH_MAX];
|
|
|
688916 |
+ char proc_mntpath[PATH_MAX];
|
|
|
688916 |
+ char lv_mapper_path[PATH_MAX];
|
|
|
688916 |
+ char mntent_mount_dir[PATH_MAX];
|
|
|
688916 |
char *dm_name;
|
|
|
688916 |
struct stat st_lv;
|
|
|
688916 |
struct stat stme;
|
|
|
688916 |
@@ -262,14 +262,14 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
|
|
|
688916 |
continue;
|
|
|
688916 |
if (stme.st_dev != st_lv.st_rdev)
|
|
|
688916 |
continue;
|
|
|
688916 |
- strncpy(mntent_mount_dir, me->mnt_dir, PATH_MAX-1);
|
|
|
688916 |
+ dm_strncpy(mntent_mount_dir, me->mnt_dir, sizeof(mntent_mount_dir));
|
|
|
688916 |
}
|
|
|
688916 |
endmntent(fme);
|
|
|
688916 |
|
|
|
688916 |
if (!(dm_name = dm_build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL)))
|
|
|
688916 |
return_0;
|
|
|
688916 |
|
|
|
688916 |
- if ((dm_snprintf(lv_mapper_path, 1024, "%s/%s", dm_dir(), dm_name) < 0))
|
|
|
688916 |
+ if ((dm_snprintf(lv_mapper_path, sizeof(lv_mapper_path), "%s/%s", dm_dir(), dm_name) < 0))
|
|
|
688916 |
return_0;
|
|
|
688916 |
|
|
|
688916 |
if (!(fp = fopen("/proc/mounts", "r")))
|
|
|
688916 |
--
|
|
|
688916 |
2.39.1
|
|
|
688916 |
|