fix for bad lengths being passed to string functions.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 15 Jul 2013 05:11:14 +0000 (05:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 15 Jul 2013 05:11:14 +0000 (05:11 +0000)
source/blender/blenkernel/BKE_sequencer.h
source/blender/editors/interface/interface_panel.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/windowmanager/intern/wm_operators.c

index 9fc0812fff7ca27756f9b5f8eeb9194d7bd97bc2..4494d127082091e498b0966b19523194f0662510 100644 (file)
@@ -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;
 
index b13de64d0c7e48613798b6df527182f03bc69710..3fe11ad3a6bd274c0c1ae73e05bbfa75518fe112 100644 (file)
@@ -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
index 7d7dccdf0e69970221d76b51d229a3506f3628d8..4d904ab6551e19d87ae2707dc18c5c5ca769fd1b 100644 (file)
@@ -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);
index def907d5dc0033a8bc36017be18be6f86e59ad57..93dfc347b1f370ca24626e76f49da419c01511c2 100644 (file)
@@ -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);
index b9a9d6b195755144ce2a3c3fb6f98e6a274e7cbe..981467cbba6f5c4d356218b0fc8be6e20206e1f2 100644 (file)
@@ -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 */