diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-22 16:48:39 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-22 16:48:39 +0300 |
commit | cbae82ba960a0baaae6437b176a310f078ce07d8 (patch) | |
tree | 6c962009e68510462550cc5a0f16618d93844b6c /source | |
parent | 626201683ec0d96e86d681bb0273a324cdf91916 (diff) |
Fix T78823: Slash in custom property name does not work
Some characters: `'`, `"`, and `\`, can cause problems with RNA paths.
Instead of using more complicated handling to deal with those cases,
we can just prevent these characters from being used in custom property
names.
This commit checks for these characters to `idp_try_read_name`, where
other checks like length are already done.
Differential Revision: https://developer.blender.org/D8839
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 314a34e3dec..6f5f36ec42f 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -20,6 +20,8 @@ #include <Python.h> +#include <string.h> + #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" @@ -370,6 +372,11 @@ static const char *idp_try_read_name(PyObject *name_obj) "the length of IDProperty names is limited to 63 characters"); return NULL; } + + if (strchr(name, '\"') || strchr(name, '\\') || strchr(name, '\'')) { + PyErr_SetString(PyExc_KeyError, "IDProperty names cannot include \", \\, or \'"); + return NULL; + } } else { name = ""; |