mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +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 -
|
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.
|
Free any previously-set string if a dm_task_set_* function is called again.
|
||||||
Do not allow passing empty new name for dmsetup rename.
|
Do not allow passing empty new name for dmsetup rename.
|
||||||
Display any output returned by 'dmsetup message'.
|
Display any output returned by 'dmsetup message'.
|
||||||
|
@ -771,6 +771,8 @@ static int _message(CMD_ARGS)
|
|||||||
struct dm_task *dmt;
|
struct dm_task *dmt;
|
||||||
char *str;
|
char *str;
|
||||||
const char *response;
|
const char *response;
|
||||||
|
uint64_t sector;
|
||||||
|
char *endptr;
|
||||||
|
|
||||||
if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
|
if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
|
||||||
return 0;
|
return 0;
|
||||||
@ -785,7 +787,12 @@ static int _message(CMD_ARGS)
|
|||||||
argv++;
|
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;
|
goto out;
|
||||||
|
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user