mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
tools: Avoid overflow in _get_int_arg.
Use strtoull instead of strtol so that argument size is not cut to 31 bytes on machines with 32-bit long. (Mikulas)
This commit is contained in:
parent
a0ca2c11ee
commit
6e912d949b
@ -1,5 +1,6 @@
|
||||
Version 2.02.101 -
|
||||
===================================
|
||||
Use strtoull instead of strtol in _get_int_arg.
|
||||
Add devtypes report command to display built-in recognised block device types.
|
||||
Fix CC Makefile override which had reverted to using built-in value. (2.02.75)
|
||||
Recognise bcache block devices in filter (experimental).
|
||||
|
@ -241,7 +241,7 @@ int metadatatype_arg(struct cmd_context *cmd, struct arg_values *av)
|
||||
static int _get_int_arg(struct arg_values *av, char **ptr)
|
||||
{
|
||||
char *val;
|
||||
long v;
|
||||
unsigned long long v;
|
||||
|
||||
av->percent = PERCENT_NONE;
|
||||
|
||||
@ -262,9 +262,10 @@ static int _get_int_arg(struct arg_values *av, char **ptr)
|
||||
if (!isdigit(*val))
|
||||
return 0;
|
||||
|
||||
v = strtol(val, ptr, 10);
|
||||
errno = 0;
|
||||
v = strtoull(val, ptr, 10);
|
||||
|
||||
if (*ptr == val)
|
||||
if (*ptr == val || errno)
|
||||
return 0;
|
||||
|
||||
av->i_value = (int32_t) v;
|
||||
|
Loading…
Reference in New Issue
Block a user