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/editors/space_image
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/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_ops.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index a092895c39e..9cea8d4f220 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1279,7 +1279,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
Image *ima;
PointerRNA ptr, idptr;
PropertyRNA *prop;
- char name[22];
+ char name[MAX_ID_NAME-2];
float color[4];
int width, height, floatbuf, uvtestgrid, alpha;
@@ -1352,7 +1352,7 @@ void IMAGE_OT_new(wmOperatorType *ot)
ot->flag= OPTYPE_UNDO;
/* properties */
- RNA_def_string(ot->srna, "name", "untitled", sizeof(((ID *)NULL)->name)-2, "Name", "Image datablock name.");
+ RNA_def_string(ot->srna, "name", "untitled", MAX_ID_NAME-2, "Name", "Image datablock name.");
RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width.", 1, 16384);
RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height.", 1, 16384);
prop= RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color.", 0.0f, 1.0f);
@@ -1538,7 +1538,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
/* find the suppplied image by name */
if (RNA_property_is_set(op->ptr, "id")) {
- char imaname[22];
+ char imaname[MAX_ID_NAME-2];
RNA_string_get(op->ptr, "id", imaname);
ima = BLI_findstring(&CTX_data_main(C)->image, imaname, offsetof(ID, name) + 2);
if (!ima) ima = CTX_data_edit_image(C);
@@ -1604,7 +1604,7 @@ void IMAGE_OT_unpack(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "method", unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack.");
- RNA_def_string(ot->srna, "id", "", sizeof(((ID *)NULL)->name)-2, "Image Name", "Image datablock name to unpack."); /* XXX, weark!, will fail with library, name collisions */
+ RNA_def_string(ot->srna, "id", "", MAX_ID_NAME-2, "Image Name", "Image datablock name to unpack."); /* XXX, weark!, will fail with library, name collisions */
}
/******************** sample image operator ********************/