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

libdm: fix buffer overflow

(cherry picked from commit 8a0af1bec8)
This commit is contained in:
Marian Csontos 2018-06-21 10:20:09 +02:00
parent 0c00af776a
commit fdb6ef8a85

View File

@ -1763,7 +1763,7 @@ static int _mountinfo_parse_line(const char *line, unsigned *maj, unsigned *min,
return 0; return 0;
} }
devmapper += 12; /* skip fixed prefix */ devmapper += 12; /* skip fixed prefix */
for (i = 0; devmapper[i] && devmapper[i] != ' ' && i < sizeof(root); ++i) for (i = 0; devmapper[i] && devmapper[i] != ' ' && i < sizeof(root)-1; ++i)
root[i] = devmapper[i]; root[i] = devmapper[i];
root[i] = 0; root[i] = 0;
_unmangle_mountinfo_string(root, buf); _unmangle_mountinfo_string(root, buf);