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>2011-04-19 10:59:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-19 10:59:49 +0400
commit5b920bc2ff1e78767842b13f6997298b7e438204 (patch)
tree762e490545d634d6f1d3c394f26e392b82a4aa6d /source/blender/python
parent6a91cf9adb750810d942104cf6ce5fef5a7bf999 (diff)
Some strings to store ID names were too small, could cause stack corruption.
corrected these and replaced 'sizeof(((ID *)NULL)->name)-2' with 'MAX_ID_NAME-2'.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/bpy_internal_import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 0ea4e083e3e..f2514af20b4 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -132,7 +132,7 @@ PyObject *bpy_text_import(Text *text)
PyObject *bpy_text_import_name(char *name, int *found)
{
Text *text;
- char txtname[22]; /* 21+NULL */
+ char txtname[MAX_ID_NAME-2];
int namelen= strlen(name);
//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
Main *maggie= bpy_import_main;
@@ -144,7 +144,7 @@ PyObject *bpy_text_import_name(char *name, int *found)
return NULL;
}
- if (namelen>21-3) return NULL; /* we know this cant be importable, the name is too long for blender! */
+ if (namelen >= (MAX_ID_NAME-2) - 3) return NULL; /* we know this cant be importable, the name is too long for blender! */
memcpy(txtname, name, namelen);
memcpy(&txtname[namelen], ".py", 4);