mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-08 08:58:50 +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 -
|
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.
|
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)
|
Fix CC Makefile override which had reverted to using built-in value. (2.02.75)
|
||||||
Recognise bcache block devices in filter (experimental).
|
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)
|
static int _get_int_arg(struct arg_values *av, char **ptr)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
long v;
|
unsigned long long v;
|
||||||
|
|
||||||
av->percent = PERCENT_NONE;
|
av->percent = PERCENT_NONE;
|
||||||
|
|
||||||
@ -262,9 +262,10 @@ static int _get_int_arg(struct arg_values *av, char **ptr)
|
|||||||
if (!isdigit(*val))
|
if (!isdigit(*val))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
v = strtol(val, ptr, 10);
|
errno = 0;
|
||||||
|
v = strtoull(val, ptr, 10);
|
||||||
|
|
||||||
if (*ptr == val)
|
if (*ptr == val || errno)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
av->i_value = (int32_t) v;
|
av->i_value = (int32_t) v;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user