fix for bad lengths being passed to string functions.

This commit is contained in:
Campbell Barton 2013-07-15 05:11:14 +00:00
parent 2b6f35d686
commit bf77d35f69
5 changed files with 7 additions and 11 deletions

@ -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;

@ -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

@ -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);

@ -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);

@ -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 */