Prevent std::memcpy from being called on null pointer in binding-sandbox/binding-base.h

This commit is contained in:
刘皓 2025-07-02 10:35:38 -04:00
parent 3b0d8e7458
commit 2aa09e8529
No known key found for this signature in database
GPG key ID: 7901753DB465B711

View file

@ -223,7 +223,9 @@ namespace mkxp_sandbox {
std::abort();
}
T *dst = (T *)sandbox_ptr(instance, dst_address);
std::memcpy(dst, src, num_elements * sizeof(T));
if (num_elements > 0) {
std::memcpy(dst, src, num_elements * sizeof(T));
}
#endif
}