1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 11:55:23 +03:00

sd-device: Allocate enough room for tags string

Fix commit 1d88a2: We need to allocate another byte for building the "tags"
string, as we append an extra ':' and still need the NUL terminator.
This commit is contained in:
Martin Pitt 2016-04-06 23:50:39 +02:00
parent bf8f7583ee
commit 817ec8cc81

View File

@ -1492,7 +1492,7 @@ static int device_properties_prepare(sd_device *device) {
for (tag = sd_device_get_tag_first(device); tag; tag = sd_device_get_tag_next(device)) {
char *e;
if (!GREEDY_REALLOC(tags, tags_allocated, tags_len + strlen(tag) + 1))
if (!GREEDY_REALLOC(tags, tags_allocated, tags_len + strlen(tag) + 2))
return -ENOMEM;
e = stpcpy(stpcpy(tags + tags_len, tag), ":");
tags_len = e - tags;