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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-12 12:58:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-12 12:58:28 +0300
commit3396f73c1719db18500d4741d4fc21d6bba9423c (patch)
tree077ff5327e232279874cdcfaecc55b0612e3617b /source
parent5af9e5fda96bbf47ebf6bb5cfdd6b67bcbb365cb (diff)
fix for possible (but unlikely) problem with strncpy not adding \0 and then extending the string with strcat. use BLI_snprintf instead.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c11
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c6
2 files changed, 6 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 4d3a908edb0..2e2decdf84d 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3744,8 +3744,6 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
FluidsimSettings *fss= fluidmd->fss;
ParticleSettings *part = psys->part;
ParticleData *pa=NULL;
- const char *suffix = "fluidsurface_particles_####";
- const char *suffix2 = ".gz";
char filename[256];
char debugStrBuffer[256];
int curFrame = sim->scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading
@@ -3755,14 +3753,13 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
// XXX if(ob==G.obedit) // off...
// return;
-
+
// ok, start loading
- strcpy(filename, fss->surfdataPath);
- strcat(filename, suffix);
+ BLI_snprintf(filename, sizeof(filename), "%sfluidsurface_particles_####.gz", fss->surfdataPath);
+
BLI_path_abs(filename, G.main->name);
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
- strcat(filename, suffix2);
-
+
gzf = gzopen(filename, "rb");
if (!gzf) {
snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename);
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index 81b4b75aa03..55045a927bc 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -85,14 +85,12 @@ static int fluidsim_find_lastframe(FluidsimSettings *fss)
char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR];
int curFrame = 1;
- strncpy(targetDir, fss->surfdataPath, FILE_MAXDIR);
- strcat(targetDir,"fluidsurface_final_####");
+ BLI_snprintf(targetDir, sizeof(targetDir), "%sfluidsurface_final_####.bobj.gz", fss->surfdataPath);
BLI_path_abs(targetDir, G.main->name);
do {
- strcpy(targetFile,targetDir);
+ BLI_strncpy(targetFile, targetDir, sizeof(targetFile));
BLI_path_frame(targetFile, curFrame++, 0);
- strcat(targetFile, ".bobj.gz");
} while(BLI_exist(targetFile));
return curFrame - 1;