diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-15 07:56:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-15 07:56:05 +0400 |
commit | 317b649bb241726d8be1a700cd0028f28914595d (patch) | |
tree | 8fc5953f8da6481ad72e55d247b144ac72eb2638 /source/blender/editors/space_file | |
parent | f9c41eaaf80fdddb24d5b95cadb51ac859c2d301 (diff) |
fix for buffer overrun with BLI_split_dirfile(...), was simple to do since many places don't check for filename lengyj of 79 chars which is the limit for the file selector.
Add max dir and file length args.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0955d264ca8..559873bd601 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -666,7 +666,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) if((prop= RNA_struct_find_property(op->ptr, "filepath"))) { char filepath[FILE_MAX]; RNA_property_string_get(op->ptr, prop, filepath); - BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } else { if((prop= RNA_struct_find_property(op->ptr, "filename"))) { @@ -1143,7 +1143,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) if(BLI_exists(sfile->params->dir) && BLI_is_dir(sfile->params->dir) == 0) { char path[sizeof(sfile->params->dir)]; BLI_strncpy(path, sfile->params->dir, sizeof(path)); - BLI_split_dirfile(path, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } BLI_cleanup_dir(G.main->name, sfile->params->dir); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 6cc42b2a751..f36145aaba0 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -113,7 +113,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) if (!sfile->params) { sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams"); /* set path to most recently opened .blend */ - BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); sfile->params->filter_glob[0] = '\0'; } @@ -142,7 +142,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) sfile->params->file[0]= '\0'; } else { - BLI_split_dirfile(name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } } else { @@ -613,7 +613,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) DIR *dir; struct dirent *de; - BLI_split_dirfile(str, dirname, NULL); + BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0); dir = opendir(dirname); |