]> sourceware.org Git - lvm2.git/commitdiff
Test uuid for NULL
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 30 Nov 2010 22:53:37 +0000 (22:53 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 30 Nov 2010 22:53:37 +0000 (22:53 +0000)
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

index 241fa7422fe8c58b5d97f146b8669969cb058350..1a56d2418aff71564451c87269a1f39704af7c4e 100644 (file)
@@ -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;
This page took 0.040344 seconds and 5 git commands to generate.