1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: check sscanf result

This commit is contained in:
Zdenek Kabelac 2020-09-12 13:03:07 +02:00
parent a5d45b237d
commit 740d5bf6cd

View File

@ -887,8 +887,8 @@ static int read_adopt_file(struct list_head *vg_lockd)
continue; continue;
else if (!strncmp(adopt_line, "lvmlockd", 8)) { else if (!strncmp(adopt_line, "lvmlockd", 8)) {
unsigned int v_major = 0, v_minor = 0; unsigned int v_major = 0, v_minor = 0;
sscanf(adopt_line, "lvmlockd adopt_version %u.%u", &v_major, &v_minor); if ((sscanf(adopt_line, "lvmlockd adopt_version %u.%u", &v_major, &v_minor) != 2) ||
if (v_major != ADOPT_VERSION_MAJOR) (v_major != ADOPT_VERSION_MAJOR))
goto fail; goto fail;
} else if (!strncmp(adopt_line, "VG:", 3)) { } else if (!strncmp(adopt_line, "VG:", 3)) {