diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-21 18:48:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-21 18:48:07 +0400 |
commit | 7add5e2bac1833f3f7c67245d412bd1ec8329cda (patch) | |
tree | d2b3a56bb930b37ebe2b2b24f97e4b17076eee1f | |
parent | 2c9f5f1f7c6153db67d892d09946fbb2455f4c73 (diff) |
Better api use for paths.
Avoid possibly copy past buffer.
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index c3cbb9dbe5f..af57be33969 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2474,7 +2474,7 @@ static void confirm_operator(bContext *C, wmOperator *op, const char *title, con char *s, buf[512]; s= buf; - if (title) s+= sprintf(s, "%s%%t|%s", title, item); + if (title) s+= BLI_snprintf(s, sizeof(buf), "%s%%t|%s", title, item); (void)s; handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 32fe8498eaf..b5059d157b9 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -586,7 +586,7 @@ const char * filelist_dir(struct FileList* filelist) void filelist_setdir(struct FileList* filelist, const char *dir) { - BLI_strncpy(filelist->dir, dir, FILE_MAX); + BLI_strncpy(filelist->dir, dir, sizeof(filelist->dir)); } void filelist_imgsize(struct FileList* filelist, short w, short h) @@ -853,10 +853,9 @@ static void filelist_read_library(struct FileList* filelist) for(num=0; num<filelist->numfiles; num++, file++) { if(BLO_has_bfile_extension(file->relname)) { char name[FILE_MAX]; - - BLI_strncpy(name, filelist->dir, sizeof(name)); - strcat(name, file->relname); - + + BLI_join_dirfile(name, sizeof(name), filelist->dir, file->relname); + /* prevent current file being used as acceptable dir */ if (BLI_path_cmp(G.main->name, name) != 0) { file->type &= ~S_IFMT; |