1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

dmeventd: check for msg.data nonnull

Ensure we will not use  msg.data as NULL for strchr.
This commit is contained in:
Zdenek Kabelac 2013-04-19 17:03:50 +02:00
parent ba3cee3630
commit 45f396f2a0

View File

@ -815,13 +815,13 @@ int dm_event_get_version(struct dm_event_fifos *fifos, int *version) {
p = msg.data;
*version = 0;
p = strchr(p, ' '); /* Message ID */
if (!p) return 0;
p = strchr(p + 1, ' '); /* HELLO */
if (!p) return 0;
p = strchr(p + 1, ' '); /* HELLO, once more */
if (p)
if (!p || !(p = strchr(p, ' '))) /* Message ID */
return 0;
if (!(p = strchr(p + 1, ' '))) /* HELLO */
return 0;
if ((p = strchr(p + 1, ' '))) /* HELLO, once more */
*version = atoi(p);
return 1;
}