strcpy() --> BLI_strncpy(), where source strings are not fixed and target size is known.

This commit is contained in:
Campbell Barton 2011-10-19 23:10:54 +00:00
parent 364fcde86d
commit 5cf593a778
39 changed files with 118 additions and 122 deletions

@ -51,7 +51,7 @@ struct PackedFile *newPackedFileMemory(void *mem, int memlen);
void packAll(struct Main *bmain, struct ReportList *reports); void packAll(struct Main *bmain, struct ReportList *reports);
/* unpack */ /* unpack */
char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how); char *unpackFile(struct ReportList *reports, const char *abs_name, const char *local_name, struct PackedFile *pf, int how);
int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how); int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how);
int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how); int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how);
int unpackImage(struct ReportList *reports, struct Image *ima, int how); int unpackImage(struct ReportList *reports, struct Image *ima, int how);

@ -906,8 +906,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (scene->r.stamp & R_STAMP_MARKER) { if (scene->r.stamp & R_STAMP_MARKER) {
char *name = scene_find_last_marker_name(scene, CFRA); char *name = scene_find_last_marker_name(scene, CFRA);
if (name) strcpy(text, name); if (name) BLI_strncpy(text, name, sizeof(text));
else strcpy(text, "<none>"); else strcpy(text, "<none>");
BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text); BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text);
@ -980,7 +980,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (scene->r.stamp & R_STAMP_SEQSTRIP) { if (scene->r.stamp & R_STAMP_SEQSTRIP) {
Sequence *seq= seq_foreground_frame_get(scene, scene->r.cfra); Sequence *seq= seq_foreground_frame_get(scene, scene->r.cfra);
if (seq) strcpy(text, seq->name+2); if (seq) BLI_strncpy(text, seq->name+2, sizeof(text));
else strcpy(text, "<none>"); else strcpy(text, "<none>");
BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text); BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text);

@ -86,8 +86,8 @@ ModifierData *modifier_new(int type)
ModifierTypeInfo *mti = modifierType_getInfo(type); ModifierTypeInfo *mti = modifierType_getInfo(type);
ModifierData *md = MEM_callocN(mti->structSize, mti->structName); ModifierData *md = MEM_callocN(mti->structSize, mti->structName);
// FIXME: we need to make the name always be unique somehow... /* note, this name must be made unique later */
strcpy(md->name, mti->name); BLI_strncpy(md->name, mti->name, sizeof(md->name));
md->type = type; md->type = type;
md->mode = eModifierMode_Realtime md->mode = eModifierMode_Realtime

@ -374,7 +374,7 @@ void nodeMakeDynamicType(bNode *node)
/*node->typeinfo= MEM_dupallocN(ntype);*/ /*node->typeinfo= MEM_dupallocN(ntype);*/
bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType"); bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType");
*newtype= *ntype; *newtype= *ntype;
strcpy(newtype->name, ntype->name); BLI_strncpy(newtype->name, ntype->name, sizeof(newtype->name));
node->typeinfo= newtype; node->typeinfo= newtype;
} }
} }

@ -182,7 +182,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
// convert relative filenames to absolute filenames // convert relative filenames to absolute filenames
strcpy(name, filename); BLI_strncpy(name, filename, sizeof(name));
BLI_path_abs(name, basepath); BLI_path_abs(name, basepath);
// open the file // open the file
@ -240,7 +240,7 @@ void packAll(Main *bmain, ReportList *reports)
} }
/* #if 0
// attempt to create a function that generates an unique filename // attempt to create a function that generates an unique filename
// this will work when all funtions in fileops.c understand relative filenames... // this will work when all funtions in fileops.c understand relative filenames...
@ -249,6 +249,7 @@ static char *find_new_name(char *name)
{ {
char tempname[FILE_MAXDIR + FILE_MAXFILE]; char tempname[FILE_MAXDIR + FILE_MAXFILE];
char *newname; char *newname;
size_t len;
if (fop_exists(name)) { if (fop_exists(name)) {
for (number = 1; number <= 999; number++) { for (number = 1; number <= 999; number++) {
@ -258,14 +259,12 @@ static char *find_new_name(char *name)
} }
} }
} }
len= strlen(tempname) + 1;
newname = mallocN(strlen(tempname) + 1, "find_new_name"); newname = MEM_mallocN(len, "find_new_name");
strcpy(newname, tempname); memcpy(newname, tempname, len * sizeof(char));
return newname;
return(newname);
} }
#endif
*/
int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, int guimode) int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, int guimode)
{ {
@ -277,12 +276,12 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
if (guimode) {} //XXX waitcursor(1); if (guimode) {} //XXX waitcursor(1);
strcpy(name, filename); BLI_strncpy(name, filename, sizeof(name));
BLI_path_abs(name, G.main->name); BLI_path_abs(name, G.main->name);
if (BLI_exists(name)) { if (BLI_exists(name)) {
for (number = 1; number <= 999; number++) { for (number = 1; number <= 999; number++) {
sprintf(tempname, "%s.%03d_", name, number); BLI_snprintf(tempname, sizeof(tempname), "%s.%03d_", name, number);
if (! BLI_exists(tempname)) { if (! BLI_exists(tempname)) {
if (BLI_copy_fileops(name, tempname) == RET_OK) { if (BLI_copy_fileops(name, tempname) == RET_OK) {
remove_tmp = TRUE; remove_tmp = TRUE;
@ -342,7 +341,7 @@ int checkPackedFile(const char *filename, PackedFile *pf)
char buf[4096]; char buf[4096];
char name[FILE_MAXDIR + FILE_MAXFILE]; char name[FILE_MAXDIR + FILE_MAXFILE];
strcpy(name, filename); BLI_strncpy(name, filename, sizeof(name));
BLI_path_abs(name, G.main->name); BLI_path_abs(name, G.main->name);
if (stat(name, &st)) { if (stat(name, &st)) {
@ -392,9 +391,10 @@ there was an error or when the user desides to cancel the operation.
*/ */
char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFile *pf, int how) char *unpackFile(ReportList *reports, const char *abs_name, const char *local_name, PackedFile *pf, int how)
{ {
char *newname = NULL, *temp = NULL; char *newname = NULL;
const char *temp = NULL;
// char newabs[FILE_MAXDIR + FILE_MAXFILE]; // char newabs[FILE_MAXDIR + FILE_MAXFILE];
// char newlocal[FILE_MAXDIR + FILE_MAXFILE]; // char newlocal[FILE_MAXDIR + FILE_MAXFILE];
@ -437,12 +437,11 @@ char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFi
} }
if (temp) { if (temp) {
newname = MEM_mallocN(strlen(temp) + 1, "unpack_file newname"); newname= BLI_strdup(temp);
strcpy(newname, temp);
} }
} }
return (newname); return newname;
} }
@ -453,17 +452,17 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how)
int ret_value = RET_ERROR; int ret_value = RET_ERROR;
if (vfont != NULL) { if (vfont != NULL) {
strcpy(localname, vfont->name); BLI_strncpy(localname, vfont->name, sizeof(localname));
BLI_splitdirstring(localname, fi); BLI_splitdirstring(localname, fi);
sprintf(localname, "//fonts/%s", fi); BLI_snprintf(localname, sizeof(localname), "//fonts/%s", fi);
newname = unpackFile(reports, vfont->name, localname, vfont->packedfile, how); newname = unpackFile(reports, vfont->name, localname, vfont->packedfile, how);
if (newname != NULL) { if (newname != NULL) {
ret_value = RET_OK; ret_value = RET_OK;
freePackedFile(vfont->packedfile); freePackedFile(vfont->packedfile);
vfont->packedfile = NULL; vfont->packedfile = NULL;
strcpy(vfont->name, newname); BLI_strncpy(vfont->name, newname, sizeof(vfont->name));
MEM_freeN(newname); MEM_freeN(newname);
} }
} }
@ -478,13 +477,13 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how)
int ret_value = RET_ERROR; int ret_value = RET_ERROR;
if (sound != NULL) { if (sound != NULL) {
strcpy(localname, sound->name); BLI_strncpy(localname, sound->name, sizeof(localname));
BLI_splitdirstring(localname, fi); BLI_splitdirstring(localname, fi);
sprintf(localname, "//sounds/%s", fi); BLI_snprintf(localname, sizeof(localname), "//sounds/%s", fi);
newname = unpackFile(reports, sound->name, localname, sound->packedfile, how); newname = unpackFile(reports, sound->name, localname, sound->packedfile, how);
if (newname != NULL) { if (newname != NULL) {
strcpy(sound->name, newname); BLI_strncpy(sound->name, newname, sizeof(sound->name));
MEM_freeN(newname); MEM_freeN(newname);
freePackedFile(sound->packedfile); freePackedFile(sound->packedfile);
@ -506,16 +505,16 @@ int unpackImage(ReportList *reports, Image *ima, int how)
int ret_value = RET_ERROR; int ret_value = RET_ERROR;
if (ima != NULL) { if (ima != NULL) {
strcpy(localname, ima->name); BLI_strncpy(localname, ima->name, sizeof(localname));
BLI_splitdirstring(localname, fi); BLI_splitdirstring(localname, fi);
sprintf(localname, "//textures/%s", fi); BLI_snprintf(localname, sizeof(localname), "//textures/%s", fi);
newname = unpackFile(reports, ima->name, localname, ima->packedfile, how); newname = unpackFile(reports, ima->name, localname, ima->packedfile, how);
if (newname != NULL) { if (newname != NULL) {
ret_value = RET_OK; ret_value = RET_OK;
freePackedFile(ima->packedfile); freePackedFile(ima->packedfile);
ima->packedfile = NULL; ima->packedfile = NULL;
strcpy(ima->name, newname); BLI_strncpy(ima->name, newname, sizeof(ima->name));
MEM_freeN(newname); MEM_freeN(newname);
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
} }

@ -2891,24 +2891,24 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to)
char ext[MAX_PTCACHE_PATH]; char ext[MAX_PTCACHE_PATH];
/* save old name */ /* save old name */
strcpy(old_name, pid->cache->name); BLI_strncpy(old_name, pid->cache->name, sizeof(old_name));
/* get "from" filename */ /* get "from" filename */
strcpy(pid->cache->name, from); BLI_strncpy(pid->cache->name, from, sizeof(pid->cache->name));
len = ptcache_filename(pid, old_filename, 0, 0, 0); /* no path */ len = ptcache_filename(pid, old_filename, 0, 0, 0); /* no path */
ptcache_path(pid, path); ptcache_path(pid, path);
dir = opendir(path); dir = opendir(path);
if(dir==NULL) { if(dir==NULL) {
strcpy(pid->cache->name, old_name); BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name));
return; return;
} }
BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
/* put new name into cache */ /* put new name into cache */
strcpy(pid->cache->name, to); BLI_strncpy(pid->cache->name, to, sizeof(pid->cache->name));
while ((de = readdir(dir)) != NULL) { while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@ -2963,7 +2963,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
if(cache->index >= 0) if(cache->index >= 0)
BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index);
else else
strcpy(ext, PTCACHE_EXT); BLI_strncpy(ext, PTCACHE_EXT, sizeof(ext));
while ((de = readdir(dir)) != NULL) { while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (strstr(de->d_name, ext)) { /* do we have the right extension?*/

@ -166,7 +166,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
int i= 0; int i= 0;
/* strip numbers */ /* strip numbers */
strcpy(base_name, prop->name); BLI_strncpy(base_name, prop->name, sizeof(base_name));
for(i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) { for(i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) {
base_name[i]= '\0'; base_name[i]= '\0';
} }
@ -178,7 +178,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
strcat(new_name, num); strcat(new_name, num);
} while(get_property__internal(first, prop, new_name)); } while(get_property__internal(first, prop, new_name));
strcpy(prop->name, new_name); BLI_strncpy(prop->name, new_name, sizeof(prop->name));
} }
} }
} }
@ -257,7 +257,7 @@ void set_property(bProperty *prop, char *str)
*((float *)&prop->data)= (float)atof(str); *((float *)&prop->data)= (float)atof(str);
break; break;
case GPROP_STRING: case GPROP_STRING:
strcpy(prop->poin, str); strcpy(prop->poin, str); /* TODO - check size? */
break; break;
} }

@ -866,8 +866,8 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq)
SeqUniqueInfo sui; SeqUniqueInfo sui;
char *dot; char *dot;
sui.seq= seq; sui.seq= seq;
strcpy(sui.name_src, seq->name+2); BLI_strncpy(sui.name_src, seq->name+2, sizeof(sui.name_src));
strcpy(sui.name_dest, seq->name+2); BLI_strncpy(sui.name_dest, seq->name+2, sizeof(sui.name_dest));
sui.count= 1; sui.count= 1;
sui.match= 1; /* assume the worst to start the loop */ sui.match= 1; /* assume the worst to start the loop */
@ -887,7 +887,7 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq)
seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui); seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui);
} }
strcpy(seq->name+2, sui.name_dest); BLI_strncpy(seq->name+2, sui.name_dest, sizeof(seq->name)-2);
} }
static const char *give_seqname_by_type(int type) static const char *give_seqname_by_type(int type)
@ -1204,7 +1204,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra,
sorry folks, please rebuild your proxies... */ sorry folks, please rebuild your proxies... */
if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) {
strcpy(dir, seq->strip->proxy->dir); BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
} else if (seq->type == SEQ_IMAGE) { } else if (seq->type == SEQ_IMAGE) {
BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
} else { } else {
@ -3360,9 +3360,9 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
SWAP(Sequence, *seq_a, *seq_b); SWAP(Sequence, *seq_a, *seq_b);
/* swap back names so animation fcurves dont get swapped */ /* swap back names so animation fcurves dont get swapped */
strcpy(name, seq_a->name+2); BLI_strncpy(name, seq_a->name+2, sizeof(name));
strcpy(seq_a->name+2, seq_b->name+2); BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2);
strcpy(seq_b->name+2, name); BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2);
/* swap back opacity, and overlay mode */ /* swap back opacity, and overlay mode */
SWAP(int, seq_a->blend_mode, seq_b->blend_mode); SWAP(int, seq_a->blend_mode, seq_b->blend_mode);

@ -79,9 +79,9 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename)
char str[FILE_MAX]; char str[FILE_MAX];
char *path; char *path;
int len; size_t len;
strcpy(str, filename); BLI_strncpy(str, filename, sizeof(str));
path = /*bmain ? bmain->name :*/ G.main->name; path = /*bmain ? bmain->name :*/ G.main->name;

@ -992,7 +992,7 @@ void autotexname(Tex *tex)
if(tex->type==TEX_IMAGE) { if(tex->type==TEX_IMAGE) {
ima= tex->ima; ima= tex->ima;
if(ima) { if(ima) {
strcpy(di, ima->name); BLI_strncpy(di, ima->name, sizeof(di));
BLI_splitdirstring(di, fi); BLI_splitdirstring(di, fi);
strcpy(di, "I."); strcpy(di, "I.");
strcat(di, fi); strcat(di, fi);

@ -227,7 +227,7 @@ int BLI_move(const char *file, const char *to) {
// it has to be 'mv filename filename' and not // it has to be 'mv filename filename' and not
// 'mv filename destdir' // 'mv filename destdir'
strcpy(str, to); BLI_strncpy(str, to, sizeof(str));
// points 'to' to a directory ? // points 'to' to a directory ?
if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(str) == (str + strlen(str) - 1)) {
if (BLI_last_slash(file) != NULL) { if (BLI_last_slash(file) != NULL) {
@ -252,7 +252,7 @@ int BLI_copy_fileops(const char *file, const char *to) {
// it has to be 'cp filename filename' and not // it has to be 'cp filename filename' and not
// 'cp filename destdir' // 'cp filename destdir'
strcpy(str, to); BLI_strncpy(str, to, sizeof(str));
// points 'to' to a directory ? // points 'to' to a directory ?
if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(str) == (str + strlen(str) - 1)) {
if (BLI_last_slash(file) != NULL) { if (BLI_last_slash(file) != NULL) {
@ -286,7 +286,7 @@ void BLI_recurdir_fileops(const char *dirname) {
// blah1/blah2/ (with slash) after creating // blah1/blah2/ (with slash) after creating
// blah1/blah2 (without slash) // blah1/blah2 (without slash)
strcpy(tmp, dirname); BLI_strncpy(tmp, dirname, sizeof(tmp));
lslash= BLI_last_slash(tmp); lslash= BLI_last_slash(tmp);
if (lslash == tmp + strlen(tmp) - 1) { if (lslash == tmp + strlen(tmp) - 1) {
@ -371,7 +371,7 @@ void BLI_recurdir_fileops(const char *dirname) {
if (BLI_exists(dirname)) return; if (BLI_exists(dirname)) return;
strcpy(tmp, dirname); BLI_strncpy(tmp, dirname, sizeof(tmp));
lslash= BLI_last_slash(tmp); lslash= BLI_last_slash(tmp);
if (lslash) { if (lslash) {

@ -364,7 +364,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
// get the name // get the name
fontname = FT_Get_Postscript_Name(face); fontname = FT_Get_Postscript_Name(face);
strcpy(vfd->name, (fontname == NULL) ? "" : fontname); BLI_strncpy(vfd->name, (fontname == NULL) ? "" : fontname, sizeof(vfd->name));
// Extract the first 256 character from TTF // Extract the first 256 character from TTF
lcode= charcode= FT_Get_First_Char(face, &glyph_index); lcode= charcode= FT_Get_First_Char(face, &glyph_index);

@ -304,15 +304,15 @@ void BLI_adddirstrings(void)
for(num=0, file= files; num<actnum; num++, file++){ for(num=0, file= files; num<actnum; num++, file++){
#ifdef WIN32 #ifdef WIN32
mode = 0; mode = 0;
strcpy(file->mode1, types[0]); BLI_strncpy(file->mode1, types[0], sizeof(file->mode1));
strcpy(file->mode2, types[0]); BLI_strncpy(file->mode2, types[0], sizeof(file->mode2));
strcpy(file->mode3, types[0]); BLI_strncpy(file->mode3, types[0], sizeof(file->mode3));
#else #else
mode = file->s.st_mode; mode = file->s.st_mode;
strcpy(file->mode1, types[(mode & 0700) >> 6]); BLI_strncpy(file->mode1, types[(mode & 0700) >> 6], sizeof(file->mode1));
strcpy(file->mode2, types[(mode & 0070) >> 3]); BLI_strncpy(file->mode2, types[(mode & 0070) >> 3], sizeof(file->mode2));
strcpy(file->mode3, types[(mode & 0007)]); BLI_strncpy(file->mode3, types[(mode & 0007)], sizeof(file->mode3));
if (((mode & S_ISGID) == S_ISGID) && (file->mode2[2]=='-'))file->mode2[2]='l'; if (((mode & S_ISGID) == S_ISGID) && (file->mode2[2]=='-'))file->mode2[2]='l';

@ -252,7 +252,7 @@ void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendH
void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports); BlendFileData* blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -42,8 +42,8 @@ extern "C" {
struct BlendFileData; struct BlendFileData;
struct ReportList; struct ReportList;
int BLO_is_a_runtime(char *file); int BLO_is_a_runtime(const char *file);
struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports); struct BlendFileData *BLO_read_runtime(const char *file, struct ReportList *reports);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -288,7 +288,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
fd = blo_openblendermemfile(memfile, reports); fd = blo_openblendermemfile(memfile, reports);
if (fd) { if (fd) {
fd->reports= reports; fd->reports= reports;
strcpy(fd->relabase, filename); BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase));
/* clear ob->proxy_from pointers in old main */ /* clear ob->proxy_from pointers in old main */
blo_clear_proxy_pointers_from_lib(oldmain); blo_clear_proxy_pointers_from_lib(oldmain);

@ -9275,7 +9275,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
simasel->prv_h = 96; simasel->prv_h = 96;
simasel->prv_w = 96; simasel->prv_w = 96;
simasel->flag = 7; /* ??? elubie */ simasel->flag = 7; /* ??? elubie */
strcpy (simasel->dir, U.textudir); /* TON */ BLI_strncpy (simasel->dir, U.textudir, sizeof(simasel->dir)); /* TON */
simasel->file[0]= '\0'; simasel->file[0]= '\0';
simasel->returnfunc = NULL; simasel->returnfunc = NULL;
@ -9498,7 +9498,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
ct->tar = data->tar; ct->tar = data->tar;
strcpy(ct->subtarget, data->subtarget); BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
ct->space = con->tarspace; ct->space = con->tarspace;
BLI_addtail(&data->targets, ct); BLI_addtail(&data->targets, ct);
@ -9528,7 +9528,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
ct->tar = data->tar; ct->tar = data->tar;
strcpy(ct->subtarget, data->subtarget); BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
ct->space = con->tarspace; ct->space = con->tarspace;
BLI_addtail(&data->targets, ct); BLI_addtail(&data->targets, ct);
@ -12008,8 +12008,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
aa->flag = ia->flag; aa->flag = ia->flag;
aa->sta = ia->sta; aa->sta = ia->sta;
aa->end = ia->end; aa->end = ia->end;
strcpy(aa->name, ia->name); BLI_strncpy(aa->name, ia->name, sizeof(aa->name));
strcpy(aa->frameProp, ia->frameProp); BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp));
if (ob->adt) if (ob->adt)
aa->act = ob->adt->action; aa->act = ob->adt->action;
@ -13651,8 +13651,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
printf(" enter a new path:\n"); printf(" enter a new path:\n");
if(scanf("%s", newlib_path) > 0) { if(scanf("%s", newlib_path) > 0) {
strcpy(mainptr->curlib->name, newlib_path); BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name));
strcpy(mainptr->curlib->filepath, newlib_path); BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath));
cleanup_path(G.main->name, mainptr->curlib->filepath); cleanup_path(G.main->name, mainptr->curlib->filepath);
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
@ -13768,7 +13768,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
/* reading runtime */ /* reading runtime */
BlendFileData *blo_read_blendafterruntime(int file, char *name, int actualsize, ReportList *reports) BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actualsize, ReportList *reports)
{ {
BlendFileData *bfd = NULL; BlendFileData *bfd = NULL;
FileData *fd = filedata_new(); FileData *fd = filedata_new();

@ -68,7 +68,7 @@ static int handle_read_msb_int(int handle)
return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0); return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0);
} }
int BLO_is_a_runtime(char *path) int BLO_is_a_runtime(const char *path)
{ {
int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0); int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0);
int datastart; int datastart;
@ -97,7 +97,7 @@ cleanup:
return res; return res;
} }
BlendFileData *BLO_read_runtime(char *path, ReportList *reports) BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
{ {
BlendFileData *bfd= NULL; BlendFileData *bfd= NULL;
size_t actualsize; size_t actualsize;

@ -691,7 +691,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
if (is_joint) if (is_joint)
BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str);
else else
strcpy(rna_path, tm_str); BLI_strncpy(rna_path, tm_str, sizeof(rna_path));
newcu[i] = create_fcurve(axis, rna_path); newcu[i] = create_fcurve(axis, rna_path);
newcu[i]->totvert = frames.size(); newcu[i]->totvert = frames.size();
} }
@ -1246,7 +1246,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
if (is_joint) if (is_joint)
BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str);
else else
strcpy(rna_path, tm_str); BLI_strncpy(rna_path, tm_str, sizeof(rna_path));
newcu[i] = create_fcurve(axis, rna_path); newcu[i] = create_fcurve(axis, rna_path);
#ifdef ARMATURE_TEST #ifdef ARMATURE_TEST

@ -824,7 +824,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
} }
else if (strcmp(ct->subtarget, pchan->name)==0) { else if (strcmp(ct->subtarget, pchan->name)==0) {
ct->tar = tarArm; ct->tar = tarArm;
strcpy(ct->subtarget, curbone->name); BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget));
} }
} }
} }
@ -871,7 +871,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
} }
else if (strcmp(ct->subtarget, pchan->name)==0) { else if (strcmp(ct->subtarget, pchan->name)==0) {
ct->tar = tarArm; ct->tar = tarArm;
strcpy(ct->subtarget, curbone->name); BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget));
} }
} }
} }
@ -2503,7 +2503,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj
*/ */
if (oldtarget->temp) { if (oldtarget->temp) {
newtarget = (EditBone *) oldtarget->temp; newtarget = (EditBone *) oldtarget->temp;
strcpy(ct->subtarget, newtarget->name); BLI_strncpy(ct->subtarget, newtarget->name, sizeof(ct->subtarget));
} }
} }
} }

@ -997,11 +997,8 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
} }
/* get marker name */ /* get marker name */
if (pld->marker) BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern));
strcpy(markern, pld->marker->name);
else
strcpy(markern, "No Matches");
sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern); sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern);
ED_area_headerprint(pld->sa, pld->headerstr); ED_area_headerprint(pld->sa, pld->headerstr);
} }
@ -1186,7 +1183,7 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm
/* backup stuff that needs to occur before every operation /* backup stuff that needs to occur before every operation
* - make a copy of searchstr, so that we know if cache needs to be rebuilt * - make a copy of searchstr, so that we know if cache needs to be rebuilt
*/ */
strcpy(pld->searchold, pld->searchstr); BLI_strncpy(pld->searchold, pld->searchstr, sizeof(pld->searchold));
/* if we're currently showing the original pose, only certain events are handled */ /* if we're currently showing the original pose, only certain events are handled */
if (pld->flag & PL_PREVIEW_SHOWORIGINAL) { if (pld->flag & PL_PREVIEW_SHOWORIGINAL) {

@ -311,7 +311,7 @@ void copy_gpdata ()
gpln= MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer"); gpln= MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer");
gpln->frames.first= gpln->frames.last= NULL; gpln->frames.first= gpln->frames.last= NULL;
strcpy(gpln->info, gpls->info); BLI_strncpy(gpln->info, gpls->info, sizeof(gpln->info));
BLI_addtail(&gpcopybuf, gpln); BLI_addtail(&gpcopybuf, gpln);

@ -1151,7 +1151,7 @@ void init_userdef_do_versions(void)
vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL); vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL);
if (bmain->versionfile <= 191) { if (bmain->versionfile <= 191) {
strcpy(U.plugtexdir, U.textudir); BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir));
strcpy(U.sounddir, "/"); strcpy(U.sounddir, "/");
} }

@ -245,7 +245,7 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, const c
for (ct=targets.first, i=0; ct; ct= ct->next, i++) { for (ct=targets.first, i=0; ct; ct= ct->next, i++) {
if (i == index) { if (i == index) {
ct->tar= target; ct->tar= target;
strcpy(ct->subtarget, subtarget); BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget));
break; break;
} }
} }

@ -334,11 +334,9 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
/* Add new object for the proxy */ /* Add new object for the proxy */
newob= add_object(scene, OB_EMPTY); newob= add_object(scene, OB_EMPTY);
if (gob)
strcpy(name, gob->id.name+2); BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name);
else
strcpy(name, ob->id.name+2);
strcat(name, "_proxy");
rename_id(&newob->id, name); rename_id(&newob->id, name);
/* set layers OK */ /* set layers OK */
@ -605,7 +603,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
/* handle types */ /* handle types */
if (pchan) if (pchan)
strcpy(ob->parsubstr, pchan->name); BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
else else
ob->parsubstr[0]= 0; ob->parsubstr[0]= 0;

@ -669,7 +669,7 @@ static void vgroup_duplicate(Object *ob)
} }
cdg = defgroup_duplicate(dg); cdg = defgroup_duplicate(dg);
strcpy(cdg->name, name); BLI_strncpy(cdg->name, name, sizeof(cdg->name));
defgroup_unique_name(cdg, ob); defgroup_unique_name(cdg, ob);
BLI_addtail(&ob->defbase, cdg); BLI_addtail(&ob->defbase, cdg);

@ -261,7 +261,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.alphamode= R_ADDSKY; sce->r.alphamode= R_ADDSKY;
sce->r.cfra= scene->r.cfra; sce->r.cfra= scene->r.cfra;
strcpy(sce->r.engine, scene->r.engine); BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
if(id_type==ID_MA) { if(id_type==ID_MA) {
Material *mat= NULL, *origmat= (Material *)id; Material *mat= NULL, *origmat= (Material *)id;

@ -157,7 +157,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path); RNA_string_get(op->ptr, "filepath", path);
strcpy(G.ima, path); BLI_strncpy(G.ima, path, sizeof(G.ima));
BLI_path_abs(path, G.main->name); BLI_path_abs(path, G.main->name);
/* BKE_add_image_extension() checks for if extension was already set */ /* BKE_add_image_extension() checks for if extension was already set */

@ -401,7 +401,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect);
tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile"); tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile");
strcpy(tile->idname, ima->id.name); BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname));
tile->x= x_tile; tile->x= x_tile;
tile->y= y_tile; tile->y= y_tile;
@ -409,7 +409,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char); allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char);
tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect"); tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect");
strcpy(tile->ibufname, ibuf->name); BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
tile->gen_type= ima->gen_type; tile->gen_type= ima->gen_type;
tile->source= ima->source; tile->source= ima->source;

@ -262,7 +262,7 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node)
} }
unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode"); unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode");
strcpy(unode->idname, ob->id.name); BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname));
unode->node= node; unode->node= node;
BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert); BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert);

@ -235,7 +235,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
strcpy(seq->name+2, sce_seq->id.name+2); BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2);
seqbase_unique_name_recursive(&ed->seqbase, seq); seqbase_unique_name_recursive(&ed->seqbase, seq);
seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0); seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0);

@ -929,11 +929,11 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
if(last_seq==NULL) if(last_seq==NULL)
return; return;
BLI_strncpy(from, last_seq->strip->dir, FILE_MAX); BLI_strncpy(from, last_seq->strip->dir, sizeof(from));
// XXX if (0==sbutton(from, 0, sizeof(from)-1, "From: ")) // XXX if (0==sbutton(from, 0, sizeof(from)-1, "From: "))
// return; // return;
strcpy(to, from); BLI_strncpy(to, from, sizeof(to));
// XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: ")) // XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: "))
// return; // return;

@ -1175,7 +1175,7 @@ static struct ImBuf * anim_getnew(struct anim * anim) {
case ANIM_SEQUENCE: case ANIM_SEQUENCE:
ibuf = IMB_loadiffname(anim->name, anim->ib_flags); ibuf = IMB_loadiffname(anim->name, anim->ib_flags);
if (ibuf) { if (ibuf) {
strcpy(anim->first, anim->name); BLI_strncpy(anim->first, anim->name, sizeof(anim->first));
anim->duration = 1; anim->duration = 1;
} }
break; break;

@ -179,10 +179,11 @@ static void rna_Lattice_points_w_set(PointerRNA *ptr, int value)
static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value) static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
{ {
Lattice *lt= ptr->data; Lattice *lt= ptr->data;
strcpy(lt->vgroup, value); BLI_strncpy(lt->vgroup, value, sizeof(lt->vgroup));
if(lt->editlatt) if(lt->editlatt) {
strcpy(lt->editlatt->latt->vgroup, value); BLI_strncpy(lt->editlatt->latt->vgroup, value, sizeof(lt->editlatt->latt->vgroup));
}
} }
/* annoying, but is a consequence of RNA structures... */ /* annoying, but is a consequence of RNA structures... */

@ -193,7 +193,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
pid2 = pid; pid2 = pid;
else if(cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name)==0) { else if(cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name)==0) {
/*TODO: report "name exists" to user */ /*TODO: report "name exists" to user */
strcpy(cache->name, cache->prev_name); BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
new_name = 0; new_name = 0;
} }
} }
@ -203,13 +203,13 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
char old_name[80]; char old_name[80];
char new_name[80]; char new_name[80];
strcpy(old_name, cache->prev_name); BLI_strncpy(old_name, cache->prev_name, sizeof(old_name));
strcpy(new_name, cache->name); BLI_strncpy(new_name, cache->name, sizeof(new_name));
BKE_ptcache_disk_cache_rename(pid2, old_name, new_name); BKE_ptcache_disk_cache_rename(pid2, old_name, new_name);
} }
strcpy(cache->prev_name, cache->name); BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name));
} }
} }

@ -40,6 +40,7 @@
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_edgehash.h" #include "BLI_edgehash.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h" #include "BKE_mesh.h"
@ -183,7 +184,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tsmd->crease_outer = smd->crease_outer; tsmd->crease_outer = smd->crease_outer;
tsmd->crease_rim = smd->crease_rim; tsmd->crease_rim = smd->crease_rim;
tsmd->flag = smd->flag; tsmd->flag = smd->flag;
strcpy(tsmd->defgrp_name, smd->defgrp_name); BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name));
} }
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)

@ -718,7 +718,7 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o
if(sock) { if(sock) {
sock->groupsock = gsock; sock->groupsock = gsock;
strcpy(sock->name, gsock->name); BLI_strncpy(sock->name, gsock->name, sizeof(sock->name));
sock->type= gsock->type; sock->type= gsock->type;
/* XXX hack: group socket input/output roles are inverted internally, /* XXX hack: group socket input/output roles are inverted internally,
@ -903,7 +903,7 @@ static void loop_sync(bNodeTree *ntree, int sync_in_out)
if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage)) if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage))
break; break;
/* make sure the name is the same (only for identification by user, no deeper meaning) */ /* make sure the name is the same (only for identification by user, no deeper meaning) */
strcpy(mirror->name, sock->name); BLI_strncpy(mirror->name, sock->name, sizeof(mirror->name));
/* fix the socket order if necessary */ /* fix the socket order if necessary */
if (mirror != sync) { if (mirror != sync) {
BLI_remlink(sync_lb, mirror); BLI_remlink(sync_lb, mirror);

@ -481,12 +481,12 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data)
layer= &data->layers[i]; layer= &data->layers[i];
if (layer->type == CD_MTFACE) { if (layer->type == CD_MTFACE) {
strcpy(obr->mtface[mtfn++], layer->name); BLI_strncpy(obr->mtface[mtfn++], layer->name, sizeof(layer->name));
obr->actmtface= CLAMPIS(layer->active_rnd, 0, numtf); obr->actmtface= CLAMPIS(layer->active_rnd, 0, numtf);
obr->bakemtface= layer->active; obr->bakemtface= layer->active;
} }
else if (layer->type == CD_MCOL) { else if (layer->type == CD_MCOL) {
strcpy(obr->mcol[mcn++], layer->name); BLI_strncpy(obr->mcol[mcn++], layer->name, sizeof(layer->name));
obr->actmcol= CLAMPIS(layer->active_rnd, 0, numcol); obr->actmcol= CLAMPIS(layer->active_rnd, 0, numcol);
} }
} }

@ -309,7 +309,7 @@ static void get_filename(int argc, char **argv, char *filename)
#endif // !_APPLE #endif // !_APPLE
} }
static BlendFileData *load_game_data(char *progname, char *filename = NULL, char *relativename = NULL) static BlendFileData *load_game_data(const char *progname, char *filename = NULL, char *relativename = NULL)
{ {
ReportList reports; ReportList reports;
BlendFileData *bfd = NULL; BlendFileData *bfd = NULL;
@ -321,7 +321,7 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char
bfd= BLO_read_runtime(progname, &reports); bfd= BLO_read_runtime(progname, &reports);
if (bfd) { if (bfd) {
bfd->type= BLENFILETYPE_RUNTIME; bfd->type= BLENFILETYPE_RUNTIME;
strcpy(bfd->main->name, progname); BLI_strncpy(bfd->main->name, progname, sizeof(bfd->main->name));
} }
} else { } else {
bfd= BLO_read_from_file(progname, &reports); bfd= BLO_read_from_file(progname, &reports);
@ -766,7 +766,7 @@ int main(int argc, char** argv)
char basedpath[240]; char basedpath[240];
// base the actuator filename relative to the last file // base the actuator filename relative to the last file
strcpy(basedpath, exitstring.Ptr()); BLI_strncpy(basedpath, exitstring.Ptr(), sizeof(basedpath));
BLI_path_abs(basedpath, pathname); BLI_path_abs(basedpath, pathname);
bfd = load_game_data(basedpath); bfd = load_game_data(basedpath);