From 35ae7dae9ec8502bfca37f4ca4a0d176a73668d8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 1 Oct 2012 15:39:29 +0000 Subject: fix for own bug in bmesh api, setting a byte string customdata layer assumed the input data was 256 length, assigning smaller values would read past the buffer. --- source/blender/editors/transform/transform_conversions.c | 2 ++ source/blender/python/bmesh/bmesh_py_types_customdata.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 540cbb97609..39a5da94798 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1489,6 +1489,8 @@ static void createTransCurveVerts(TransInfo *t) count++; tail++; } + + (void)hdata; /* quiet warning */ } else if (propmode && head != tail) { calc_distanceCurveVerts(head, tail - 1); diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 2a9592d21e2..0391839c763 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -1079,7 +1079,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj ret = -1; } else { - BLI_strncpy(mstring->s, tmp_val, sizeof(mstring->s)); + BLI_strncpy(mstring->s, tmp_val, MIN2(PyBytes_Size(py_value), sizeof(mstring->s))); } break; } -- cgit v1.2.3