Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-10-26 18:45:56 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-10-26 18:45:56 +0400
commitd24aaf5958c7a7e4d08991ae801e39032138a1ff (patch)
tree32a1ad1f89446e671209aa83c4318cfa001a3483 /source/blender/makesrna/intern/rna_wm.c
parent7013931b1495f57bb6ce6d5714a2c9308bab482a (diff)
Fix for a nasty (and dangerous, buffer overflow) bug that quite oddly seems to have never shown its ugly face until today (at least for me)... It was revealed by mocap's addon stupidly long operators label names (fix comming in next commit): the rna_Operator_bl_idname_set() and rna_Operator_bl_label_set() were clamping there string copy to RNA_DYN_DESCR_MAX instead of OP_MAX_TYPENAME!
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 3dffc422e13..23587bf6cd6 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1251,24 +1251,30 @@ static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value)
{
wmOperator *data = (wmOperator *)(ptr->data);
char *str = (char *)data->type->idname;
- if (!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
- else assert(!"setting the bl_idname on a non-builtin operator");
+ if (!str[0])
+ BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_idname on a non-builtin operator");
}
static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
{
wmOperator *data = (wmOperator *)(ptr->data);
char *str = (char *)data->type->name;
- if (!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
- else assert(!"setting the bl_label on a non-builtin operator");
+ if (!str[0])
+ BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_label on a non-builtin operator");
}
static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value)
{
wmOperator *data = (wmOperator *)(ptr->data);
char *str = (char *)data->type->description;
- if (!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
- else assert(!"setting the bl_description on a non-builtin operator");
+ if (!str[0])
+ BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_description on a non-builtin operator");
}
static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)