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:
authorCampbell Barton <ideasman42@gmail.com>2013-07-15 09:11:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-15 09:11:14 +0400
commitbf77d35f695030506c1b70f2eb2a2f1225ce14cc (patch)
tree9f291fed3a06aa5fca9d14e13b04fff30302ba51
parent2b6f35d686a35a347aec93cae2f018b1f7312834 (diff)
fix for bad lengths being passed to string functions.
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/space_file/filelist.c5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c7
5 files changed, 7 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 9fc0812fff7..4494d127082 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -334,7 +334,7 @@ typedef struct SeqLoadInfo {
int tot_success;
int tot_error;
int len; /* only for image strips */
- char path[512];
+ char path[1024]; /* 1024 = FILE_MAX */
char name[64];
} SeqLoadInfo;
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);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index b9a9d6b1957..981467cbba6 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -495,7 +495,7 @@ void WM_operator_py_idname(char *to, const char *from)
BLI_ascii_strtolower(to, ofs);
to[ofs] = '.';
- BLI_strncpy(to + (ofs + 1), sep + 4, OP_MAX_TYPENAME);
+ BLI_strncpy(to + (ofs + 1), sep + 4, OP_MAX_TYPENAME - (ofs + 1));
}
else {
/* should not happen but support just in case */
@@ -514,9 +514,8 @@ void WM_operator_bl_idname(char *to, const char *from)
memcpy(to, from, sizeof(char) * ofs);
BLI_ascii_strtoupper(to, ofs);
-
- BLI_strncpy(to + ofs, "_OT_", OP_MAX_TYPENAME);
- BLI_strncpy(to + (ofs + 4), sep + 1, OP_MAX_TYPENAME);
+ strcpy(to + ofs, "_OT_");
+ strcpy(to + (ofs + 4), sep + 1);
}
else {
/* should not happen but support just in case */