== bugfix ==
authorAndrea Weikert <elubie@gmx.net>
Sun, 30 Mar 2008 16:18:01 +0000 (16:18 +0000)
committerAndrea Weikert <elubie@gmx.net>
Sun, 30 Mar 2008 16:18:01 +0000 (16:18 +0000)
fix for [#6950] Blender crashes when .blog file top line is 160 characters or more
- made sure BLI_convertstringcode doesn't return more than 240 chars
- went through all callers and fixed places where string passed to BLI_convertstringcode was too short
- TODO: look into increasing sample->name and sound->name too, I prevented crashes, but filename might get shortened.

17 files changed:
source/blender/blenkernel/BKE_main.h
source/blender/blenkernel/intern/blender.c
source/blender/blenlib/intern/util.c
source/blender/makesdna/DNA_space_types.h
source/blender/python/BPY_interface.c
source/blender/python/BPY_menus.c
source/blender/python/api2_2x/Blender.c
source/blender/src/drawimasel.c
source/blender/src/editimasel.c
source/blender/src/editsound.c
source/blender/src/filelist.c
source/blender/src/filesel.c
source/blender/src/header_imasel.c
source/blender/src/header_info.c
source/blender/src/usiblender.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

index 2cfa1dc5cc41fb792f5828e6eddfb736db3443dc..bce40b6c55a7f19687e487a8f7c3b08f25e23579 100644 (file)
@@ -47,7 +47,7 @@ struct Library;
 
 typedef struct Main {
        struct Main *next, *prev;
-       char name[160];
+       char name[240];
        short versionfile, subversionfile;
        short minversionfile, minsubversionfile;
        
index 534ddc555e97a2c08e0214255ae9e99591022863..f07f5b1947a51c9f4125e4d5d3d9087f0d308d06 100644 (file)
@@ -415,7 +415,7 @@ static void setup_app_data(BlendFileData *bfd, char *filename)
        if (G.sce != filename) /* these are the same at times, should never copy to the same location */
                strcpy(G.sce, filename);
        
-       strcpy(G.main->name, filename); /* is guaranteed current file */
+       BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */
        
        MEM_freeN(bfd);
 }
index 51691499ba8f6dd81a240fa3fe148940b9ee0a22..6d8dd3d9b50e427b00ba847e5f6ecda74523816b 100644 (file)
@@ -1028,8 +1028,8 @@ void BLI_makestringcode(const char *relfile, char *file)
 int BLI_convertstringcode(char *path, const char *basepath, int framenum)
 {
        int len, wasrelative;
-       char tmp[FILE_MAXDIR+FILE_MAXFILE];
-       char base[FILE_MAXDIR];
+       char tmp[FILE_MAX];
+       char base[FILE_MAX];
        char vol[3] = {'\0', '\0', '\0'};
 
        BLI_strncpy(vol, path, 3);
@@ -1050,13 +1050,13 @@ int BLI_convertstringcode(char *path, const char *basepath, int framenum)
                strcat(tmp, p);
        }
        else {
-               strcpy(tmp, path);
+               BLI_strncpy(tmp, path, FILE_MAX);
        }
 #else
-       strcpy(tmp, path);
+       BLI_strncpy(tmp, path, FILE_MAX);
 #endif
 
-       strcpy(base, basepath);
+       BLI_strncpy(base, basepath, FILE_MAX);
        
        /* push slashes into unix mode - strings entering this part are
           potentially messed up: having both back- and forward slashes.
index fbc30f5efcc75c039278bb14c466603e66d6e9d9..f96a4fea8911d7a881728fa56f98d8e1dd38e086 100644 (file)
@@ -167,7 +167,7 @@ typedef struct SpaceFile {
        int totfile;
        
        char title[24];
-       char dir[160];
+       char dir[240];
        char file[80];
        
        short type, ofs, flag, sort;
@@ -373,7 +373,7 @@ typedef struct SpaceImaSel {
 
        /* specific stuff for drawing */
        char title[24];
-       char dir[160];
+       char dir[240];
        char file[80];
 
        short type, menu, flag, sort;
index 1f028e4907054839fb2f27e6cbf9122e3ef2bc72..7ba2a81e7166a38b15a70efe871b4a402e7e85b4 100644 (file)
@@ -1004,10 +1004,10 @@ int BPY_menu_do_python( short menutype, int event )
        }
 
        if( pym->dir ) { /* script is in U.pythondir */
-               char upythondir[FILE_MAXDIR];
+               char upythondir[FILE_MAX];
 
                /* dirs in Blender can be "//", which has a special meaning */
-               BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
+               BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
                BLI_convertstringcode(upythondir, G.sce, 0); /* if so, this expands it */
                BLI_make_file_string( "/", filestr, upythondir, pym->filename );
        }
index 202c4e40b51706cf24797a19e9de983135d852c1..36d1ed20cb769cbcfb7afd394db9cf137c4642a1 100644 (file)
@@ -457,7 +457,7 @@ static int bpymenu_CreateFromFile( void )
 {
        FILE *fp;
        char line[255], w1[255], w2[255], tooltip[255], *tip;
-       char upythondir[FILE_MAXDIR];
+       char upythondir[FILE_MAX];
        char *homedir = NULL;
        int parsing, version, is_userdir;
        short group;
@@ -494,13 +494,13 @@ static int bpymenu_CreateFromFile( void )
        w1[0] = '\0';
        fscanf( fp, "# User defined scripts dir: %[^\n]\n", w1 );
 
-       BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
-       BLI_convertstringcode(upythondir, G.sce, 0);
+               BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
+               BLI_convertstringcode(upythondir, G.sce, 0);
 
-       if( strcmp( w1, upythondir ) != 0 )
-               return -1;
+               if( strcmp( w1, upythondir ) != 0 )
+                       return -1;
 
-       w1[0] = '\0';
+               w1[0] = '\0';
 
        while( fgets( line, 255, fp ) ) {       /* parsing file lines */
 
@@ -604,9 +604,9 @@ static void bpymenu_WriteDataFile( void )
        if (U.pythondir[0] != '\0' &&
                        strcmp(U.pythondir, "/") != 0 && strcmp(U.pythondir, "//") != 0)
        {
-               char upythondir[FILE_MAXDIR];
+               char upythondir[FILE_MAX];
 
-               BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
+               BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
                BLI_convertstringcode(upythondir, G.sce, 0);
                fprintf( fp, "# User defined scripts dir: %s\n", upythondir );
        }
@@ -940,7 +940,7 @@ static int bpymenu_GetStatMTime( const char *name, int is_file, time_t * mtime )
 
 #ifdef WIN32
        if (is_file) {
-               result = stat( name, &st );
+       result = stat( name, &st );
        } else {
                /* needed for win32 only, remove trailing slash */
                char name_stat[FILE_MAX];
@@ -976,8 +976,8 @@ static int bpymenu_GetStatMTime( const char *name, int is_file, time_t * mtime )
 int BPyMenu_Init( int usedir )
 {
        char fname[FILE_MAXDIR];
-       char dirname[FILE_MAXDIR];
-       char upythondir[FILE_MAXDIR];
+       char dirname[FILE_MAX];
+       char upythondir[FILE_MAX];
        char *upydir = U.pythondir, *sdir = NULL;
        time_t time_dir1 = 0, time_dir2 = 0, time_file = 0;
        int stat_dir1 = 0, stat_dir2 = 0, stat_file = 0;
@@ -1005,14 +1005,14 @@ int BPyMenu_Init( int usedir )
                upydir = NULL;
        }
        else {
-               BLI_strncpy(upythondir, upydir, FILE_MAXDIR);
+               BLI_strncpy(upythondir, upydir, FILE_MAX);
                BLI_convertstringcode(upythondir, G.sce, 0);
        }
 
        sdir = bpy_gethome(1);
 
        if (sdir) {
-               BLI_strncpy(dirname, sdir, FILE_MAXDIR);
+               BLI_strncpy(dirname, sdir, FILE_MAX);
                stat_dir1 = bpymenu_GetStatMTime( dirname, 0, &time_dir1 );
 
                if( stat_dir1 < 0 ) {
@@ -1098,7 +1098,7 @@ the user defined Python scripts dir.\n", dirname );
                                fprintf(stderr, "Default scripts dir does not seem valid.\n\n");
                }
                if( stat_dir2 == 0 ) {
-                       BLI_strncpy(dirname, U.pythondir, FILE_MAXDIR);
+                       BLI_strncpy(dirname, U.pythondir, FILE_MAX);
                        BLI_convertstringcode(dirname, G.sce, 0);
                        i = bpymenu_ParseDir( dirname, NULL, 1 );
                        if (i == -1 && DEBUG)
index dbcd21f04f3b5a1d572f45a370e4cb16c9d218a3..89d1ec2e3aef423b5eccd437104173bb0f90b378 100644 (file)
@@ -371,9 +371,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        }
        else if(StringEqual(str, "udatadir")) {
                if (U.pythondir[0] != '\0') {
-                       char upydir[FILE_MAXDIR];
+                       char upydir[FILE_MAX];
 
-                       BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
+                       BLI_strncpy(upydir, U.pythondir, FILE_MAX);
                        BLI_convertstringcode(upydir, G.sce, 0);
 
                        if (BLI_exists(upydir)) {
@@ -397,9 +397,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        }
        else if( StringEqual( str, "uscriptsdir" ) ) {
                if (U.pythondir[0] != '\0') {
-                       char upydir[FILE_MAXDIR];
+                       char upydir[FILE_MAX];
 
-                       BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
+                       BLI_strncpy(upydir, U.pythondir, FILE_MAX);
                        BLI_convertstringcode(upydir, G.sce, 0);
 
                        if( BLI_exists( upydir ) )
@@ -410,9 +410,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* USER PREFS: */
        else if( StringEqual( str, "yfexportdir" ) ) {
                if (U.yfexportdir[0] != '\0') {
-                       char yfexportdir[FILE_MAXDIR];
+                       char yfexportdir[FILE_MAX];
 
-                       BLI_strncpy(yfexportdir, U.yfexportdir, FILE_MAXDIR);
+                       BLI_strncpy(yfexportdir, U.yfexportdir, FILE_MAX);
                        BLI_convertstringcode(yfexportdir, G.sce, 0);
 
                        if( BLI_exists( yfexportdir ) )
@@ -423,9 +423,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* fontsdir */
        else if( StringEqual( str, "fontsdir" ) ) {
                if (U.fontdir[0] != '\0') {
-                       char fontdir[FILE_MAXDIR];
+                       char fontdir[FILE_MAX];
 
-                       BLI_strncpy(fontdir, U.fontdir, FILE_MAXDIR);
+                       BLI_strncpy(fontdir, U.fontdir, FILE_MAX);
                        BLI_convertstringcode(fontdir, G.sce, 0);
 
                        if( BLI_exists( fontdir ) )
@@ -436,9 +436,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* texturesdir */
        else if( StringEqual( str, "texturesdir" ) ) {
                if (U.textudir[0] != '\0') {
-                       char textudir[FILE_MAXDIR];
+                       char textudir[FILE_MAX];
 
-                       BLI_strncpy(textudir, U.textudir, FILE_MAXDIR);
+                       BLI_strncpy(textudir, U.textudir, FILE_MAX);
                        BLI_convertstringcode(textudir, G.sce, 0);
 
                        if( BLI_exists( textudir ) )
@@ -449,9 +449,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* texpluginsdir */
        else if( StringEqual( str, "texpluginsdir" ) ) {
                if (U.plugtexdir[0] != '\0') {
-                       char plugtexdir[FILE_MAXDIR];
+                       char plugtexdir[FILE_MAX];
 
-                       BLI_strncpy(plugtexdir, U.plugtexdir, FILE_MAXDIR);
+                       BLI_strncpy(plugtexdir, U.plugtexdir, FILE_MAX);
                        BLI_convertstringcode(plugtexdir, G.sce, 0);
 
                        if( BLI_exists( plugtexdir ) )
@@ -462,9 +462,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* seqpluginsdir */
        else if( StringEqual( str, "seqpluginsdir" ) ) {
                if (U.plugseqdir[0] != '\0') {
-                       char plugseqdir[FILE_MAXDIR];
+                       char plugseqdir[FILE_MAX];
 
-                       BLI_strncpy(plugseqdir, U.plugseqdir, FILE_MAXDIR);
+                       BLI_strncpy(plugseqdir, U.plugseqdir, FILE_MAX);
                        BLI_convertstringcode(plugseqdir, G.sce, 0);
 
                        if( BLI_exists( plugseqdir ) )
@@ -475,9 +475,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* renderdir */
        else if( StringEqual( str, "renderdir" ) ) {
                if (U.renderdir[0] != '\0') {
-                       char renderdir[FILE_MAXDIR];
+                       char renderdir[FILE_MAX];
 
-                       BLI_strncpy(renderdir, U.renderdir, FILE_MAXDIR);
+                       BLI_strncpy(renderdir, U.renderdir, FILE_MAX);
                        BLI_convertstringcode(renderdir, G.sce, 0);
 
                        if( BLI_exists( renderdir ) )
@@ -488,9 +488,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* soundsdir */
        else if( StringEqual( str, "soundsdir" ) ) {
                if (U.sounddir[0] != '\0') {
-                       char sounddir[FILE_MAXDIR];
+                       char sounddir[FILE_MAX];
 
-                       BLI_strncpy(sounddir, U.sounddir, FILE_MAXDIR);
+                       BLI_strncpy(sounddir, U.sounddir, FILE_MAX);
                        BLI_convertstringcode(sounddir, G.sce, 0);
 
                        if( BLI_exists( sounddir ) )
@@ -501,9 +501,9 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        /* tempdir */
        else if( StringEqual( str, "tempdir" ) ) {
                if (U.tempdir[0] != '\0') {
-                       char tempdir[FILE_MAXDIR];
+                       char tempdir[FILE_MAX];
 
-                       BLI_strncpy(tempdir, U.tempdir, FILE_MAXDIR);
+                       BLI_strncpy(tempdir, U.tempdir, FILE_MAX);
                        BLI_convertstringcode(tempdir, G.sce, 0);
 
                        if( BLI_exists( tempdir ) )
@@ -776,9 +776,9 @@ static PyObject *Blender_ShowHelp(PyObject *self, PyObject *script)
        if (sdir) BLI_make_file_string("/", hspath, sdir, "help_browser.py");
 
        if (!sdir || (!BLI_exists(hspath) && (U.pythondir[0] != '\0'))) {
-                       char upydir[FILE_MAXDIR];
+                       char upydir[FILE_MAX];
 
-                       BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
+                       BLI_strncpy(upydir, U.pythondir, FILE_MAX);
                        BLI_convertstringcode(upydir, G.sce, 0);
                        BLI_make_file_string("/", hspath, upydir, "help_browser.py");
 
index 6fa625592be8b43a8e6db96bc96c4288ff09ba29..ddad05db46f7888d911fb0a96457ebf2664ff265 100644 (file)
@@ -332,7 +332,7 @@ static void draw_imasel_previews(ScrArea *sa, SpaceImaSel *simasel)
 
        if (!files) return;
        /* Reload directory */
-       BLI_strncpy(simasel->dir, BIF_filelist_dir(files), FILE_MAXDIR);        
+       BLI_strncpy(simasel->dir, BIF_filelist_dir(files), FILE_MAX);   
        
        type = BIF_filelist_gettype(simasel->files);    
        
index e93687fef93106a7deac2e1f5fdc712718555f5b..fed57ebe546303bafbfef6b10fe375eb2b7e8814 100644 (file)
@@ -409,7 +409,7 @@ static void free_imasel_spec(char *dir)
 static void do_library_append(SpaceImaSel *simasel)
 {
        Library *lib;
-       char dir[FILE_MAXDIR], group[32];
+       char dir[FILE_MAX], group[32];
        
        if ( BIF_filelist_islibrary(simasel->files, dir, group)==0 ) {
                error("Not a library");
@@ -956,16 +956,24 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        file = BIF_filelist_file(simasel->files, simasel->active_file);
                                        
                                        if(file && S_ISDIR(file->type)) {
-                                               strcat(simasel->dir, file->relname);                                            
-                                               strcat(simasel->dir,"/");
-                                               simasel->file[0] = '\0';
-                                               BLI_cleanup_dir(G.sce, simasel->dir);
-                                               BIF_filelist_setdir(simasel->files, simasel->dir);
-                                               BIF_filelist_free(simasel->files);
-                                               simasel->active_file = -1;
-                                               simasel->scrollpos = 0;
-                                               do_draw = 1;
-                                               do_headdraw = 1;                                                
+                                               /* the path is too long and we are not going up! */
+                                               if (strcmp(file->relname, ".") &&
+                                                       strcmp(file->relname, "..") &&
+                                                       strlen(simasel->dir) + strlen(file->relname) >= FILE_MAX ) 
+                                               {
+                                                       error("Path too long, cannot enter this directory");
+                                               } else {
+                                                       strcat(simasel->dir, file->relname);
+                                                       strcat(simasel->dir,"/");
+                                                       simasel->file[0] = '\0';
+                                                       BLI_cleanup_dir(G.sce, simasel->dir);
+                                                       BIF_filelist_setdir(simasel->files, simasel->dir);
+                                                       BIF_filelist_free(simasel->files);
+                                                       simasel->active_file = -1;
+                                                       simasel->scrollpos = 0;
+                                                       do_draw = 1;
+                                                       do_headdraw = 1;
+                                               }
                                        }
                                        else if (file)
                                        {
index 38098bdb35d13b4c5c413abff83ffaba2d1096bf..d895bfe4de7add7d84a944f5e7d5b7fb088c7b28 100644 (file)
@@ -798,6 +798,7 @@ int sound_set_sample(bSound *sound, bSample *sample)
 
 bSample *sound_new_sample(bSound *sound)
 {
+       char samplename[FILE_MAX];
        bSample *sample = NULL;
        int len;
        char *name;
@@ -824,9 +825,12 @@ bSample *sound_new_sample(bSound *sound)
                sample->alindex = SAMPLE_INVALID;
 
                /* convert sound->name to abolute filename */
-               strcpy(sample->name, sound->name);
-               BLI_convertstringcode(sample->name, G.sce, G.scene->r.cfra);
-               
+               /* TODO: increase sound->name, sample->name and strip->name to FILE_MAX, to avoid
+                  cutting off sample name here - elubie */
+               BLI_strncpy(samplename, sound->name, FILE_MAX);         
+               BLI_convertstringcode(samplename, G.sce, G.scene->r.cfra);
+               BLI_strncpy(sample->name, samplename, FILE_MAXDIR);
+
                /* connect the pf to the sample */
                if (sound->newpackedfile)
                        sample->packedfile = sound->newpackedfile;
index 42940e5be044172019d2cfbd7bb9572185f7253b..589afb7f75f4669bfe32c2693870a664f6177f92 100644 (file)
@@ -95,7 +95,7 @@ typedef struct FileList
 
        int numfiles;
        int numfiltered;
-       char dir[FILE_MAXDIR];
+       char dir[FILE_MAX];
        short type;
        short ipotype;
        struct BlendHandle *libfiledata;
@@ -370,7 +370,7 @@ struct FileList*    BIF_filelist_new()
 struct FileList*       BIF_filelist_copy(struct FileList* filelist)
 {
        FileList* p = BIF_filelist_new();
-       BLI_strncpy(p->dir, filelist->dir, FILE_MAXDIR);
+       BLI_strncpy(p->dir, filelist->dir, FILE_MAX);
        p->filelist = NULL;
        p->fidx = NULL;
        p->type = filelist->type;
@@ -438,7 +438,7 @@ const char * BIF_filelist_dir(struct FileList* filelist)
 
 void BIF_filelist_setdir(struct FileList* filelist, const char *dir)
 {
-       BLI_strncpy(filelist->dir, dir, FILE_MAXDIR);
+       BLI_strncpy(filelist->dir, dir, FILE_MAX);
 }
 
 void BIF_filelist_imgsize(struct FileList* filelist, short w, short h)
@@ -590,7 +590,7 @@ void BIF_filelist_setfilter(struct FileList* filelist, unsigned int filter)
 
 void BIF_filelist_readdir(struct FileList* filelist)
 {
-       char wdir[FILE_MAXDIR];
+       char wdir[FILE_MAX];
        int finished = 0;
 
        if (!filelist) return;
@@ -843,7 +843,7 @@ void BIF_filelist_from_library(struct FileList* filelist)
        struct ImBuf* ima;
        int ok, i, nnames, idcode;
        char filename[FILE_MAXDIR+FILE_MAXFILE];
-       char dir[FILE_MAXDIR], group[GROUP_MAX];        
+       char dir[FILE_MAX], group[GROUP_MAX];   
        
        filelist->type = FILE_LOADLIB;
 
index 597611344c66899444c56a5ad1a7c8d93ac9ce44..eeae352267e8d5313df80a42e621f1da0ef0c8a6 100644 (file)
@@ -1223,6 +1223,7 @@ static void activate_fileselect_(int type, char *title, char *file, short *menup
        }
        else if(type==FILE_LOADLIB) {
                BLI_strncpy(sfile->dir, name, sizeof(sfile->dir));
+               BLI_cleanup_dir(G.sce, sfile->dir);
                if( is_a_library(sfile, temp, group) ) {
                        /* force a reload of the library-filelist */
                        freefilelist(sfile);
@@ -1413,6 +1414,15 @@ static void filesel_execute(SpaceFile *sfile)
        struct direntry *files;
        char name[FILE_MAX];
        int a;
+       int dirlen, filelen;
+
+       /* check for added length of dir and filename - annoying, but now that dir names can already be FILE_MAX
+          we need to prevent overwriting. Alternative of shortening the name behind the user's back is greater evil 
+          - elubie */ 
+       if (strlen(sfile->dir) + strlen(sfile->file) >= FILE_MAX) {
+               okee("File and Directory name together are too long. Please use shorter names.");
+               return;
+       }
        
        filesel_prevspace();
 
@@ -1869,7 +1879,7 @@ void winqreadfilespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                /* the path is too long and we are not going up! */
                                                if (strcmp(sfile->filelist[act].relname, ".") &&
                                                        strcmp(sfile->filelist[act].relname, "..") &&
-                                                       strlen(sfile->dir) + strlen(sfile->filelist[act].relname) >= FILE_MAXDIR ) 
+                                                       strlen(sfile->dir) + strlen(sfile->filelist[act].relname) >= FILE_MAX ) 
                                                {
                                                        error("Path too long, cannot enter this directory");
                                                } else {
index 8650d620cc0d496a4498a3257eea417d2809996c..fc7ec681ad92685eb4142db7d17859a987fad761 100644 (file)
@@ -104,7 +104,7 @@ void imasel_buttons(void)
        uiBlock *block;
        short xco, xcotitle;
        char naam[256];
-       char dir[FILE_MAXDIR], group[32];
+       char dir[FILE_MAX], group[32];
        short type;
        int do_filter = 0;
 
index fb7b57ddb8da5c68732f8aeb3b02909b6ea1b2b1..b9b0d9b7b573fe8c1242aa7bf46d4d8caa9fdde1 100644 (file)
@@ -806,7 +806,7 @@ static uiBlock *verse_filemenu(void *unusedargs)
 static void do_info_filemenu(void *arg, int event)
 {
        ScrArea *sa;
-       char dir[FILE_MAXDIR];
+       char dir[FILE_MAX];
        
        if(curarea->spacetype==SPACE_INFO) {
                sa= closest_bigger_area();
@@ -828,12 +828,12 @@ static void do_info_filemenu(void *arg, int event)
                activate_fileselect(FILE_LOADLIB, "Load Library", G.lib, 0);
                break;
        case 4: /* save */
-               strcpy(dir, G.sce);
+               BLI_strncpy(dir, G.sce, FILE_MAX);
                untitled(dir);
                activate_fileselect(FILE_BLENDER, "Save As", dir, BIF_write_file);
                break;
        case 5:
-               strcpy(dir, G.sce);
+               BLI_strncpy(dir, G.sce, FILE_MAX);
                if (untitled(dir)) {
                        activate_fileselect(FILE_BLENDER, "Save As", dir, BIF_write_file);
                } else {
@@ -866,10 +866,10 @@ static void do_info_filemenu(void *arg, int event)
                {
                        extern short winqueue_break; /* editscreen.c */
                        int save_over, retval = 0;
-                       char str[FILE_MAXDIR+FILE_MAXFILE];
-                       char scestr[FILE_MAXDIR+FILE_MAXFILE];
+                       char str[FILE_MAX];
+                       char scestr[FILE_MAX];
                        
-                       strcpy(scestr, G.sce);  /* temporal store */
+                       BLI_strncpy(scestr, G.sce, FILE_MAX);   /* temporal store */
                        save_over = G.save_over;
                        BLI_make_file_string("/", str, btempdir, "quit.blend");
                        retval = BKE_read_file(str, NULL);
index 7ed1c4304315022aa86634b4d190f18035a3ee70..e74316bbb104572505773ce9bd4af8d962009cbb 100644 (file)
@@ -596,7 +596,7 @@ static void outliner_242_patch(void)
 /* only here settings for fullscreen */
 int BIF_read_homefile(int from_memory)
 {
-       char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
+       char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAX];
        char *home= BLI_gethome();
        int success;
        struct TmpFont *tf;
@@ -617,7 +617,7 @@ int BIF_read_homefile(int from_memory)
                
        G.relbase_valid = 0;
        if (!from_memory) BLI_make_file_string(G.sce, tstr, home, ".B.blend");
-       strcpy(scestr, G.sce);  /* temporal store */
+       BLI_strncpy(scestr, G.sce, FILE_MAX);   /* temporal store */
        
        /* prevent loading no UI */
        G.fileflags &= ~G_FILE_NO_UI;
@@ -913,7 +913,7 @@ void BIF_write_file(char *target)
        if (BLO_write_file(di, writeflags, &err)) {
                strcpy(G.sce, di);
                G.relbase_valid = 1;
-               strcpy(G.main->name, di);       /* is guaranteed current file */
+               BLI_strncpy(G.main->name, di, FILE_MAX);        /* is guaranteed current file */
 
                mainwindow_set_filename_to_title(G.main->name);
 
index 0e0d89825278bf7d6db2ccdb3765dbcf1c8f88e5..3b7f610b7839e1c93f289dc214d38c0b7f7806ad 100644 (file)
@@ -258,7 +258,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                        exitrequested = KX_EXIT_REQUEST_NO_REQUEST;
                        if (bfd) BLO_blendfiledata_free(bfd);
                        
-                       char basedpath[160];
+                       char basedpath[240];
                        // base the actuator filename with respect
                        // to the original file working directory
                        if (exitstring != "")
@@ -271,7 +271,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                        if (!bfd)
                        {
                                // just add "//" in front of it
-                               char temppath[162];
+                               char temppath[242];
                                strcpy(temppath, "//");
                                strcat(temppath, basedpath);
                                
index 0993446c77b62c63686756995a6a2047d6a38a61..cf45c5130987e6a280caeac4d638ecdad8fced35 100644 (file)
@@ -577,7 +577,7 @@ int main(int argc, char** argv)
                                        // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file
                                        if (exitcode == KX_EXIT_REQUEST_START_OTHER_GAME)
                                        {
-                                               char basedpath[160];
+                                               char basedpath[240];
                                                
                                                // base the actuator filename with respect
                                                // to the original file working directory