Revision: 42529
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42529
Author: campbellbarton
Date: 2011-12-09 07:35:56 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
another possible fix for bug [#29521], all callers of flip_side_name(...),
assumed it initialized the string however for 1-2 length names it returned
without doing anything.
in most cases the caller would then check if the name was different to see if
the name was flipped, incorrectly comparing the uninitialized string with the
original name.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/deform.c
trunk/blender/source/blender/editors/armature/editarmature.c
trunk/blender/source/blender/editors/armature/poseobject.c
trunk/blender/source/blender/editors/object/object_select.c
Modified: trunk/blender/source/blender/blenkernel/intern/deform.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/deform.c 2011-12-09
07:23:17 UTC (rev 42528)
+++ trunk/blender/source/blender/blenkernel/intern/deform.c 2011-12-09
07:35:56 UTC (rev 42529)
@@ -410,11 +410,15 @@
char number[MAX_VGROUP_NAME]= ""; /* The number extension string
*/
char *index=NULL;
+ /* always copy the name, since this can be called with an uninitialized
string */
+ BLI_strncpy(name, from_name, MAX_VGROUP_NAME);
+
len= BLI_strnlen(from_name, MAX_VGROUP_NAME);
- if (len < 3) return; // we don't do names like .R or .L
+ if (len < 3) {
+ /* we don't do names like .R or .L */
+ return;
+ }
- BLI_strncpy(name, from_name, MAX_VGROUP_NAME);
-
/* We first check the case with a .### extension, let's find the last
period */
if (isdigit(name[len-1])) {
index= strrchr(name, '.'); // last occurrence
Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c
2011-12-09 07:23:17 UTC (rev 42528)
+++ trunk/blender/source/blender/editors/armature/editarmature.c
2011-12-09 07:35:56 UTC (rev 42529)
@@ -161,7 +161,7 @@
EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
{
EditBone *eboflip= NULL;
- char name[32];
+ char name[MAXBONENAME];
if (ebo == NULL)
return NULL;
@@ -4663,7 +4663,7 @@
/* find flipped group */
if (dgroup && mirror) {
- char name[32];
+ char name[MAXBONENAME];
// 0 = don't strip off number extensions
flip_side_name(name, dgroup->name, FALSE);
@@ -5456,7 +5456,7 @@
{
Object *ob= CTX_data_edit_object(C);
bArmature *arm;
- char newname[32];
+ char newname[MAXBONENAME];
/* paranoia checks */
if (ELEM(NULL, ob, ob->pose))
Modified: trunk/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseobject.c 2011-12-09
07:23:17 UTC (rev 42528)
+++ trunk/blender/source/blender/editors/armature/poseobject.c 2011-12-09
07:35:56 UTC (rev 42529)
@@ -989,7 +989,7 @@
static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short
selOnly, short flip)
{
bPoseChannel *pchan;
- char name[32];
+ char name[MAXBONENAME];
short paste_ok;
/* get the name - if flipping, we must flip this first */
@@ -1740,7 +1740,7 @@
/* loop through selected bones, auto-naming them */
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
{
- char newname[32];
+ char newname[MAXBONENAME];
flip_side_name(newname, pchan->name, TRUE);
ED_armature_bone_rename(arm, pchan->name, newname);
}
Modified: trunk/blender/source/blender/editors/object/object_select.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_select.c 2011-12-09
07:23:17 UTC (rev 42528)
+++ trunk/blender/source/blender/editors/object/object_select.c 2011-12-09
07:35:56 UTC (rev 42529)
@@ -41,6 +41,7 @@
#include "DNA_modifier_types.h"
#include "DNA_property_types.h"
#include "DNA_scene_types.h"
+#include "DNA_armature_types.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
@@ -893,7 +894,7 @@
extend= RNA_boolean_get(op->ptr, "extend");
CTX_DATA_BEGIN(C, Base*, primbase, selected_bases) {
- char tmpname[32];
+ char tmpname[MAXBONENAME];
flip_side_name(tmpname, primbase->object->id.name+2, TRUE);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs