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
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2015-07-11 22:37:50 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-07-11 22:44:42 +0300
commit8c67b8ffe9fdab6698f20a39d5673b720e3d2756 (patch)
tree2e120012e02e2aa7d227c0f9bdb8a8c4eb00b205 /source/blender/editors/space_file
parent7b1489b93bc6ff5b68ecee19132f1845a65983f0 (diff)
File Browser: Fix possible bug and some minor tweaks
BLI_add_slash appended to a char *, a potential buffer overflow Also partially removed an assert, which failed after changing file format of a saved image. We need a better way to handle such cases.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/file_draw.c5
-rw-r--r--source/blender/editors/space_file/file_ops.c9
2 files changed, 3 insertions, 11 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 3c09800c310..9a5ec197797 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -160,16 +160,13 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
const struct direntry *file = sfile->files ? filelist_file(sfile->files, params->active_file) : NULL;
int overwrite_alert = file_draw_check_exists(sfile);
const bool is_active_dir = file && file->path && BLI_is_dir(file->path);
- char *dir_path = (is_active_dir && params->active_file > 0) ? file->path : params->dir;
-
- BLI_add_slash(dir_path);
/* callbacks for operator check functions */
UI_block_func_set(block, file_draw_check_cb, NULL, NULL);
but = uiDefBut(block, UI_BTYPE_TEXT, -1, "",
min_x, line1_y, line1_w - chan_offs, btn_h,
- dir_path, 0.0, (float)FILE_MAX, 0, 0,
+ params->dir, 0.0, (float)FILE_MAX, 0, 0,
TIP_("File path"));
UI_but_func_complete_set(but, autocomplete_directory, NULL);
UI_but_flag_enable(but, UI_BUT_NO_UTF8);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index c54731cc66c..bfe8be91f1a 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1265,15 +1265,10 @@ int file_exec(bContext *C, wmOperator *exec_op)
const struct direntry *file = filelist_file(sfile->files, sfile->params->active_file);
char filepath[FILE_MAX];
- /* if file is a directory it should be in sync with params->dir, otherwise
- * with params->file; file->path might be NULL on link/append */
- BLI_assert((file == NULL) ||
- (file->path == NULL) ||
- (STREQ(file->relname, sfile->params->file)) ||
- (BLI_is_dir(file->path) && STRPREFIX(file->path, sfile->params->dir)));
-
/* directory change */
if (file && S_ISDIR(file->type)) {
+ BLI_assert(file->path == NULL || STRPREFIX(file->path, sfile->params->dir));
+
if (FILENAME_IS_PARENT(file->relname)) {
BLI_parent_dir(sfile->params->dir);
}