From 9a469b62cabf3d434de68c9e698970cc7f060136 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 16 Dec 2012 08:43:05 +0000 Subject: replace strcpy with BLI_strncpy or memcpy when the size is known. --- source/blender/blenkernel/intern/customdata.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/customdata.c') diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index b2f8db0dcce..0f352dede23 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2104,7 +2104,7 @@ int CustomData_set_layer_name(const CustomData *data, int type, int n, const cha if (layer_index < 0) return 0; if (!name) return 0; - strcpy(data->layers[layer_index].name, name); + BLI_strncpy(data->layers[layer_index].name, name, sizeof(data->layers[layer_index].name)); return 1; } @@ -2854,10 +2854,11 @@ void CustomData_validate_layer_name(const CustomData *data, int type, const char * deleted, so assign the active layer to name */ index = CustomData_get_active_layer_index(data, type); - strcpy(outname, data->layers[index].name); + BLI_strncpy(outname, data->layers[index].name, MAX_CUSTOMDATA_LAYER_NAME); + } + else { + BLI_strncpy(outname, name, MAX_CUSTOMDATA_LAYER_NAME); } - else - strcpy(outname, name); } int CustomData_verify_versions(struct CustomData *data, int index) -- cgit v1.2.3