From 5ce601fbfea4a2991ab9c50604e2e9b41fac07e2 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Fri, 15 Aug 2014 19:46:10 +0200 Subject: [PATCH] metadata: allow NULL pointers in kdbus_meta_append_data() Allow NULL pointers to be passed as data argument to kdbus_meta_append_data(), so users can use the function to only make space in the metadata without actually copying any payload. --- metadata.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.c b/metadata.c index 267bb49..b2b27e6 100644 --- a/metadata.c +++ b/metadata.c @@ -162,7 +162,8 @@ int kdbus_meta_append_data(struct kdbus_meta *meta, u64 type, item->type = type; item->size = KDBUS_ITEM_HEADER_SIZE + len; - memcpy(item->data, data, len); + if (data) + memcpy(item->data, data, len); return 0; } -- 2.34.1