hotplug-rule: fix off-by-one error in blobmsg string buffer realloc
authorFelix Fietkau <nbd@openwrt.org>
Wed, 20 Feb 2013 17:46:08 +0000 (18:46 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 20 Feb 2013 17:46:08 +0000 (18:46 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
hotplug-rule.c

index b157fcd19bca926ec11a7215eaaa394afa3397b8..b90ae5238c0978adbe0f38e77abec2efb1c585c1 100644 (file)
@@ -354,7 +354,7 @@ static void cmd_add_string(const char *pattern, struct blob_attr *msg)
                }
 
                if (cur_len) {
-                       dest = blobmsg_realloc_string_buffer(&b, cur_len);
+                       dest = blobmsg_realloc_string_buffer(&b, cur_len + 1);
                        memcpy(dest + len, cur, cur_len);
                        len += cur_len;
                }