From: Zdenek Kabelac Date: Tue, 30 Nov 2010 22:53:37 +0000 (+0000) Subject: Test uuid for NULL X-Git-Tag: v2_02_91~1318 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=973db2a8230d930bea1f6e97ecb6cf465e460a6a;p=lvm2.git 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. --- 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;