Fix: use of non UTF8 string copy for thick wrapped strings in Python
Avoid potential incomplete UTF8 sequences in the Python RNA API.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_utf8.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
@@ -1770,12 +1771,12 @@ static int pyrna_py_to_prop(
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Same as bytes. */
|
||||
/* Same as bytes (except for UTF8 string copy). */
|
||||
/* XXX, this is suspect, but needed for function calls,
|
||||
* need to see if there's a better way. */
|
||||
if (data) {
|
||||
if (RNA_property_flag(prop) & PROP_THICK_WRAP) {
|
||||
BLI_strncpy((char *)data, (char *)param, RNA_property_string_maxlength(prop));
|
||||
BLI_strncpy_utf8((char *)data, (char *)param, RNA_property_string_maxlength(prop));
|
||||
}
|
||||
else {
|
||||
*((char **)data) = (char *)param;
|
||||
|
||||
Reference in New Issue
Block a user