From 817ec8cc819787240efda834483d8a7a512d2933 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 6 Apr 2016 23:50:39 +0200 Subject: 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. --- src/libsystemd/sd-device/sd-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libsystemd') diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index e9f8970d2c..e787cb69d3 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -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; -- cgit v1.2.3-54-g00ecf