Changeset 84531 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 26, 2020 10:24:15 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r84472 r84531 32 32 #include <iprt/crypto/store.h> 33 33 #include <iprt/crypto/x509.h> 34 #include <iprt/rand.h> 34 35 35 36 #include <VBox/vd.h> … … 1428 1429 if (SUCCEEDED(hrc)) 1429 1430 { 1430 /** @todo r=bird: Please try find a less convoluted way of adding some random1431 * number to the name, we've got RTRandU64() for instance which you1432 * could combine with strVMName.appendPrintfNoThrow.1433 *1434 * The code below is also accessing heap after it has been freed.1435 * Guid.toString() returns a Utf8Str object which expires and is deleted1436 * once strrchr returns.1437 */1438 1431 /* what to do? create a new name from the old one with some suffix? */ 1439 com::Guid newId; 1440 newId.create(); 1441 /* 1442 * GUID has the string form "00000000-0000-0000-0000-00000000000". 1443 * Find the last part and append only it. The last 12 characters. 1444 */ 1445 const char* cpLast = strrchr(newId.toString().c_str(), '-'); 1446 strVMName.append("__").append(cpLast+1); 1432 uint64_t suff = RTRandU64(); 1433 strVMName.append("__").appendPrintfNoThrow("%ul", suff); 1447 1434 1448 1435 vsd->RemoveDescriptionByType(VirtualSystemDescriptionType_Name);
Note:
See TracChangeset
for help on using the changeset viewer.