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:
authorCampbell Barton <ideasman42@gmail.com>2007-09-05 08:17:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-09-05 08:17:55 +0400
commit5116048649bce99794ebcf2305ad17df280565a7 (patch)
tree7adf618f3dd45f6ec1de749acec7b1ae155f39b7
parent9eb46e47fcbe493b79b8b8387d5dcf186178387d (diff)
printing a pose's bone dict was limited to 4096 characters otherwise it would crash.
malloc the string instead.
-rw-r--r--source/blender/python/api2_2x/Pose.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Pose.c b/source/blender/python/api2_2x/Pose.c
index 67a1f222ea6..ed25c15c9f5 100644
--- a/source/blender/python/api2_2x/Pose.c
+++ b/source/blender/python/api2_2x/Pose.c
@@ -57,6 +57,8 @@
#include "DNA_armature_types.h" /*used for pose bone select*/
+#include "MEM_guardedalloc.h"
+
extern void chan_calc_mat(bPoseChannel *chan);
//------------------------ERROR CODES---------------------------------
@@ -143,11 +145,14 @@ static int PoseBonesDict_InitBones(BPy_PoseBonesDict *self)
//This is the string representation of the object
static PyObject *PoseBonesDict_repr(BPy_PoseBonesDict *self)
{
- char buffer[128], str[4096];
+ char buffer[128], *str;
PyObject *key, *value;
int pos = 0;
-
- BLI_strncpy(str,"",4096);
+
+ /* probably a bit of overkill but better then crashing */
+ str = MEM_mallocN( 64 + ( PyDict_Size( self->bonesMap ) * 128), "PoseBonesDict_repr" );
+ str[0] = '\0';
+
sprintf(buffer, "[Pose Bone Dict: {");
strcat(str,buffer);
while (PyDict_Next(self->bonesMap, &pos, &key, &value)) {
@@ -157,6 +162,9 @@ static PyObject *PoseBonesDict_repr(BPy_PoseBonesDict *self)
}
sprintf(buffer, "}]\n");
strcat(str,buffer);
+
+ MEM_freeN( str );
+
return PyString_FromString(str);
}