From c697497923cfb6d0ef68cf4955a1c90445e84c39 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 30 Nov 2010 22:53:37 +0000 Subject: [PATCH] Test uuid for NULL Add test for NULL before passing uuid as src argument to memcpy. As memcpy function is declared as function not accepting NULL. Though we pass NULL only with zero length so this patch presents no functional change to the code. --- tools/dmsetup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/dmsetup.c b/tools/dmsetup.c index 241fa7422..1a56d2418 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -343,7 +343,9 @@ static char *_extract_uuid_prefix(const char *uuid, const int separator) return NULL; } - memcpy(uuid_prefix, uuid, len); + if (uuid) + memcpy(uuid_prefix, uuid, len); + uuid_prefix[len] = '\0'; return uuid_prefix; -- 2.43.5