diff options
author | Andrea Weikert <elubie@gmx.net> | 2008-03-30 20:18:01 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2008-03-30 20:18:01 +0400 |
commit | d9de141077873c9379d0bd6ea745b60f5180c4d2 (patch) | |
tree | 36c40794cad938487904814b022f886b9eef9cc9 /source/blender/src/filesel.c | |
parent | cc4858cde045d17cef5ea9c847484e3168364bd4 (diff) |
== bugfix ==
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.
Diffstat (limited to 'source/blender/src/filesel.c')
-rw-r--r-- | source/blender/src/filesel.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index 597611344c6..eeae352267e 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -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 { |