mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-07 21:18:59 +03:00
Use proper size of strncpy
Avoid reading extra character if we expect to have there '\0'.
This commit is contained in:
parent
77e3ec4e28
commit
d8d824c6c5
2
lib/cache/lvmcache.c
vendored
2
lib/cache/lvmcache.c
vendored
@ -1287,7 +1287,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(pvid_s, pvid, sizeof(pvid_s));
|
strncpy(pvid_s, pvid, sizeof(pvid_s) - 1);
|
||||||
pvid_s[sizeof(pvid_s) - 1] = '\0';
|
pvid_s[sizeof(pvid_s) - 1] = '\0';
|
||||||
|
|
||||||
if (!(existing = info_from_pvid(pvid_s, 0)) &&
|
if (!(existing = info_from_pvid(pvid_s, 0)) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user