diff options
Diffstat (limited to 'commands/of_property.c')
-rw-r--r-- | commands/of_property.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/commands/of_property.c b/commands/of_property.c index bd9ff72fbc..1567a0f164 100644 --- a/commands/of_property.c +++ b/commands/of_property.c @@ -255,9 +255,15 @@ static int do_of_property(int argc, char *argv[]) if (pp) { free(pp->value); + /* limit property data to the actual size */ - data = xrealloc(data, len); - pp->value = data; + if (len) { + pp->value = xrealloc(data, len); + } else { + pp->value = NULL; + free(data); + } + pp->length = len; } else { pp = of_new_property(node, propname, data, len); |