[Bf-blender-cvs] [6f1c44e] master: Some fixes from coverity (only one really nasty, in paint_proj).

Bastien Montagne noreply at git.blender.org
Mon Dec 28 16:09:15 CET 2015


Commit: 6f1c44e61180a5551a874ad382ff52ad664ada1c
Author: Bastien Montagne
Date:   Mon Dec 28 16:08:36 2015 +0100
Branches: master
https://developer.blender.org/rB6f1c44e61180a5551a874ad382ff52ad664ada1c

Some fixes from coverity (only one really nasty, in paint_proj).

===================================================================

M	source/blender/blenlib/intern/fileops.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c

===================================================================

diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 5dc1014..401bdd4 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -825,7 +825,7 @@ static int copy_single_file(const char *from, const char *to)
 		ssize_t link_len;
 
 		/* get large enough buffer to read link content */
-		if (st.st_size < sizeof(buf)) {
+		if ((st.st_size + 1) < sizeof(buf)) {
 			link_buffer = buf;
 			need_free = 0;
 		}
@@ -843,7 +843,7 @@ static int copy_single_file(const char *from, const char *to)
 			return RecursiveOp_Callback_Error;
 		}
 
-		link_buffer[link_len] = 0;
+		link_buffer[link_len] = '\0';
 
 		if (symlink(link_buffer, to)) {
 			perror("symlink");
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 4e85d89..25cdc1b 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5730,7 +5730,7 @@ static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *
 	BLI_assert(type != -1);
 
 	/* take the second letter to avoid the ID identifier */
-	BLI_snprintf(imagename, FILE_MAX, "%s %s", &ma->id.name[2], layer_type_items[type].name);
+	BLI_snprintf(imagename, sizeof(imagename), "%s %s", &ma->id.name[2], layer_type_items[type].name);
 
 	RNA_string_set(op->ptr, "name", imagename);
 	return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, 5 * UI_UNIT_Y);




More information about the Bf-blender-cvs mailing list