diff --git a/libntfs-3g/ioctl.c b/libntfs-3g/ioctl.c index 6c49395d..66cedaf9 100644 --- a/libntfs-3g/ioctl.c +++ b/libntfs-3g/ioctl.c @@ -141,7 +141,8 @@ static int fstrim_limits(ntfs_volume *vol, u64 *discard_max_bytes) { struct stat statbuf; - char path1[80], path2[80]; + char path1[40]; /* holds "/sys/dev/block/%d:%d" */ + char path2[40 + sizeof(path1)]; /* less than 40 bytes more than path1 */ int ret; /* Stat the backing device. Caller has ensured it is a block device. */ diff --git a/libntfs-3g/realpath.c b/libntfs-3g/realpath.c index a93bc698..d56667e4 100644 --- a/libntfs-3g/realpath.c +++ b/libntfs-3g/realpath.c @@ -45,8 +45,8 @@ canonicalize_dm_name(const char *ptname, char *canonical) { FILE *f; size_t sz; - char path[MAPPERNAMELTH + 24]; char name[MAPPERNAMELTH + 16]; + char path[sizeof(name) + 16]; char *res = NULL; snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname);