Update PhDuplicateStringZ buffer length
@@ -702,7 +702,7 @@ PWSTR PhDuplicateStringZ(
PWSTR newString;
SIZE_T length;
- length = (PhCountStringZ(String) + sizeof(UNICODE_NULL)) * sizeof(WCHAR); // include the null terminator
+ length = PhCountStringZ(String) * sizeof(WCHAR) + sizeof(UNICODE_NULL); // include the null terminator
newString = PhAllocate(length);
memcpy(newString, String, length);
