diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-15 09:11:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-15 09:11:14 +0400 |
commit | bf77d35f695030506c1b70f2eb2a2f1225ce14cc (patch) | |
tree | 9f291fed3a06aa5fca9d14e13b04fff30302ba51 /source/blender/editors | |
parent | 2b6f35d686a35a347aec93cae2f018b1f7312834 (diff) |
fix for bad lengths being passed to string functions.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 2 |
3 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index b13de64d0c7..3fe11ad3a6b 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -255,7 +255,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int pa->sizey = 0; } - BLI_strncpy(pa->drawname, drawname, UI_MAX_NAME_STR); + BLI_strncpy(pa->drawname, drawname, sizeof(pa->drawname)); /* if a new panel is added, we insert it right after the panel * that was last added. this way new panels are inserted in the diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 7d7dccdf0e6..4d904ab6551 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -463,10 +463,7 @@ void folderlist_pushdir(ListBase *folderlist, const char *dir) /* create next folder element */ folder = (FolderList *)MEM_mallocN(sizeof(FolderList), "FolderList"); - folder->foldername = (char *)MEM_mallocN(sizeof(char) * (strlen(dir) + 1), "foldername"); - folder->foldername[0] = '\0'; - - BLI_strncpy(folder->foldername, dir, FILE_MAXDIR); + folder->foldername = BLI_strdup(dir); /* add it to the end of the list */ BLI_addtail(folderlist, folder); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index def907d5dc0..93dfc347b1f 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -118,7 +118,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, Scene *scene = CTX_data_scene(C); Sequence *last_seq = BKE_sequencer_active_get(scene); if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) { - char path[sizeof(last_seq->strip->dir)]; + char path[FILE_MAX]; BLI_strncpy(path, last_seq->strip->dir, sizeof(path)); BLI_path_abs(path, G.main->name); RNA_string_set(op->ptr, identifier, path); |