Pārlūkot izejas kodu

Update uuid.cpp

add a malloc to target to make sure it has the length to take the string
marauder2k7 1 gadu atpakaļ
vecāks
revīzija
80a1f0a0c5
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3 1
      Engine/source/core/util/uuid.cpp

+ 3 - 1
Engine/source/core/util/uuid.cpp

@@ -153,7 +153,9 @@ static void format_token(char *target, const xuuid_t *u)
             u->node[0], u->node[1], u->node[2],
             u->node[3], u->node[4], u->node[5]);
    
-   snprintf(target, len+1, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+   target = (char*)dMalloc(len+1);
+   
+   snprintf(target, len, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
             u->time_low, u->time_mid, u->time_hi_and_version,
             u->clock_seq_hi_and_reserved, u->clock_seq_low,
             u->node[0], u->node[1], u->node[2],