Index: /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 84530)
+++ /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 84531)
@@ -32,4 +32,5 @@
 #include <iprt/crypto/store.h>
 #include <iprt/crypto/x509.h>
+#include <iprt/rand.h>
 
 #include <VBox/vd.h>
@@ -1428,21 +1429,7 @@
             if (SUCCEEDED(hrc))
             {
-                /** @todo r=bird: Please try find a less convoluted way of adding some random
-                 *        number to the name, we've got RTRandU64() for instance which you
-                 *        could combine with strVMName.appendPrintfNoThrow.
-                 *
-                 *        The code below is also accessing heap after it has been freed.
-                 *        Guid.toString() returns a Utf8Str object which expires and is deleted
-                 *        once strrchr returns.
-                 */
                 /* what to do? create a new name from the old one with some suffix? */
-                com::Guid newId;
-                newId.create();
-                /*
-                 * GUID has the string form "00000000-0000-0000-0000-00000000000".
-                 * Find the last part and append only it. The last 12 characters.
-                 */
-                const char* cpLast = strrchr(newId.toString().c_str(), '-');
-                strVMName.append("__").append(cpLast+1);
+                uint64_t suff = RTRandU64();
+                strVMName.append("__").appendPrintfNoThrow("%ul", suff);
 
                 vsd->RemoveDescriptionByType(VirtualSystemDescriptionType_Name);
