1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmcmdline: validate size as double

Since we are reading size as (double) we can get way bigger
number then just plain int64. So to make this check actually
more valid and usable do a maxsize compare in 'double'.
This commit is contained in:
Zdenek Kabelac 2017-07-16 09:53:49 +02:00
parent 28e319ddc0
commit 94838b4df0
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.173 - Version 2.02.173 -
================================= =================================
Improve --size args validation and report more detailed error message.
Initialize debugging mutex before any debug message in clvmd. Initialize debugging mutex before any debug message in clvmd.
Log error instad of warn when noticing connection problem with lvmetad. Log error instad of warn when noticing connection problem with lvmetad.
Fix memory leak in lvmetad when working with duplicates. Fix memory leak in lvmetad when working with duplicates.

View File

@ -617,7 +617,8 @@ static int _size_arg(struct cmd_context *cmd __attribute__((unused)),
} else } else
v *= factor; v *= factor;
if ((uint64_t) v >= (UINT64_MAX >> SECTOR_SHIFT)) { /* Compare (double) */
if (v >= (double) (UINT64_MAX >> SECTOR_SHIFT)) {
log_error("Size is too big (>=16EiB)."); log_error("Size is too big (>=16EiB).");
return 0; return 0;
} }