mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmsetup: Detect invalid sector supplied to message.
atoll doesn't check for errors, so invalid sector numbers were silently accepted in the "dmsetup message" command. (Mikulas)
This commit is contained in:
parent
6e912d949b
commit
68f841fcda
@ -1,5 +1,6 @@
|
||||
Version 1.02.80 -
|
||||
==================================
|
||||
Detect invalid sector supplied to 'dmsetup message'.
|
||||
Free any previously-set string if a dm_task_set_* function is called again.
|
||||
Do not allow passing empty new name for dmsetup rename.
|
||||
Display any output returned by 'dmsetup message'.
|
||||
|
@ -771,6 +771,8 @@ static int _message(CMD_ARGS)
|
||||
struct dm_task *dmt;
|
||||
char *str;
|
||||
const char *response;
|
||||
uint64_t sector;
|
||||
char *endptr;
|
||||
|
||||
if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
|
||||
return 0;
|
||||
@ -785,7 +787,12 @@ static int _message(CMD_ARGS)
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (!dm_task_set_sector(dmt, (uint64_t) atoll(argv[1])))
|
||||
sector = strtoull(argv[1], &endptr, 10);
|
||||
if (*endptr || endptr == argv[1]) {
|
||||
err("invalid sector");
|
||||
goto out;
|
||||
}
|
||||
if (!dm_task_set_sector(dmt, sector))
|
||||
goto out;
|
||||
|
||||
argc -= 2;
|
||||
|
Loading…
Reference in New Issue
Block a user