[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44952] trunk/blender/source/blender/ editors/physics/physics_fluid.c: fix for invalid use of strncat (N == how many bytes may be appended, not the final string size).

Campbell Barton ideasman42 at gmail.com
Sat Mar 17 23:14:54 CET 2012


Revision: 44952
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44952
Author:   campbellbarton
Date:     2012-03-17 22:14:52 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
fix for invalid use of strncat (N == how many bytes may be appended, not the final string size).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/physics/physics_fluid.c

Modified: trunk/blender/source/blender/editors/physics/physics_fluid.c
===================================================================
--- trunk/blender/source/blender/editors/physics/physics_fluid.c	2012-03-17 22:12:17 UTC (rev 44951)
+++ trunk/blender/source/blender/editors/physics/physics_fluid.c	2012-03-17 22:14:52 UTC (rev 44952)
@@ -654,6 +654,7 @@
 
 
 #define FLUID_SUFFIX_CONFIG		"fluidsim.cfg"
+#define FLUID_SUFFIX_CONFIG_TMP	(FLUID_SUFFIX_CONFIG ".tmp")
 #define FLUID_SUFFIX_SURFACE	"fluidsurface"
 
 static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetFile, char *debugStrBuffer)
@@ -663,7 +664,7 @@
 	FILE *fileCfg;
 	int dirExist = 0;
 	char newSurfdataPath[FILE_MAX]; // modified output settings
-	const char *suffixConfig = FLUID_SUFFIX_CONFIG;
+	const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP;
 	int outStringsChanged = 0;
 
 	// prepare names...
@@ -673,9 +674,8 @@
 	BLI_strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); /* if 0'd out below, this value is never used! */
 	BLI_path_abs(targetDir, relbase); // fixed #frame-no
 
-	BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfig);
 	/* .tmp: dont overwrite/delete original file */
-	strncat(targetFile, ".tmp", FILE_MAX);
+	BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfigTmp);
 
 	// make sure all directories exist
 	// as the bobjs use the same dir, this only needs to be checked
@@ -881,7 +881,7 @@
 	int gridlevels = 0;
 	const char *relbase= modifier_path_relbase(fsDomain);
 	const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp
-	const char *suffixConfig = FLUID_SUFFIX_CONFIG;
+	const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP;
 	const char *suffixSurface = FLUID_SUFFIX_SURFACE;
 
 	char targetDir[FILE_MAX];  // store & modify output settings
@@ -994,8 +994,7 @@
 
 	/* ********  start writing / exporting ******** */
 	// use .tmp, dont overwrite/delete original file
-	BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfig);
-	strncat(targetFile, ".tmp", sizeof(targetFile));
+	BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfigTmp);
 	
 	// make sure these directories exist as well
 	if(outStringsChanged) {




More information about the Bf-blender-cvs mailing list