From c709ef9805ce5701e29323b3c83a412370d48d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 14 Oct 2008 22:30:43 +0000 Subject: [PATCH] * Changed how the string for the UUID hash is build. * Accidently did not start at different positions in the string to build the hash, but just added some value to the hash... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28112 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tools/vmdkimage/vmdkimage.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/tools/vmdkimage/vmdkimage.cpp b/src/tools/vmdkimage/vmdkimage.cpp index f5164da8da..843dfcd3d4 100644 --- a/src/tools/vmdkimage/vmdkimage.cpp +++ b/src/tools/vmdkimage/vmdkimage.cpp @@ -318,19 +318,21 @@ main(int argc, char *argv[]) strcpy(fullPath, "Haiku"); if (realpath(file, fullPath + 5) == NULL) - strncpy(fullPath, file, sizeof(fullPath)); + strncpy(fullPath + 5, file, sizeof(fullPath) - 5); - for (size_t i = strlen(fullPath); i < sizeof(fullPath) - 1; i++) { + size_t pathLength = strlen(fullPath); + for (size_t i = pathLength; i < 42; i++) { // fill rest with some numbers fullPath[i] = i % 10 + '0'; } - fullPath[sizeof(fullPath) - 1] = '\0'; + if (pathLength < 42) + fullPath[42] = '\0'; uuid1 = hash_string(fullPath); - uuid2 = hash_string(fullPath) + 5; - uuid3 = hash_string(fullPath) + 13; - uuid4 = hash_string(fullPath) + 19; - uuid5 = hash_string(fullPath) + 29; + uuid2 = hash_string(fullPath + 5); + uuid3 = hash_string(fullPath + 13); + uuid4 = hash_string(fullPath + 19); + uuid5 = hash_string(fullPath + 29); } // Create embedded descriptor