mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Fix message check
Check pointer from strchr for NULL instead of crash later. Badly formated message would have crash dmeventd otherwise.
This commit is contained in:
parent
c559180cca
commit
777a797ec3
@ -1,5 +1,6 @@
|
||||
Version 1.02.70 -
|
||||
===================================
|
||||
Fix dm_event_get_version() check.
|
||||
Add pointer test for dependency check in _add_dev().
|
||||
Validate name and uuid params of dm_tree_add_new_dev_with_udev_flags().
|
||||
Do not crash for dm_report_init() sort_key == NULL and behave like "".
|
||||
|
@ -811,11 +811,11 @@ int dm_event_get_version(struct dm_event_fifos *fifos, int *version) {
|
||||
p = msg.data;
|
||||
*version = 0;
|
||||
|
||||
p = strchr(p, ' ') + 1; /* Message ID */
|
||||
p = strchr(p, ' '); /* Message ID */
|
||||
if (!p) return 0;
|
||||
p = strchr(p, ' ') + 1; /* HELLO */
|
||||
p = strchr(p + 1, ' '); /* HELLO */
|
||||
if (!p) return 0;
|
||||
p = strchr(p, ' '); /* HELLO, once more */
|
||||
p = strchr(p + 1, ' '); /* HELLO, once more */
|
||||
if (p)
|
||||
*version = atoi(p);
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user