From: Martin Pitt Date: Wed, 6 Apr 2016 21:50:39 +0000 (+0200) Subject: sd-device: Allocate enough room for tags string X-Git-Tag: v230~203^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=817ec8cc819787240efda834483d8a7a512d2933;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index e9f8970d2ca..e787cb69d34 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;