Some minor fixes from coverity reports.
authorBastien Montagne <montagne29@wanadoo.fr>
Sun, 10 Jan 2016 08:45:57 +0000 (09:45 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Sun, 10 Jan 2016 08:45:57 +0000 (09:45 +0100)
source/blender/blenloader/intern/readfile.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_info/info_ops.c

index fd144c0ebc05273c5149790d11d9d3290319b8e0..a8c868a6210e8ac51bf94353e176c3f1bcabe1c2 100644 (file)
@@ -10025,7 +10025,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                                        printf("        relative lib: %s\n", mainptr->curlib->name);
                                                        printf("  enter a new path:\n");
                                                        
-                                                       if (scanf("%s", newlib_path) > 0) {
+                                                       if (scanf("%1023s", newlib_path) > 0) {  /* Warning, keep length in sync with FILE_MAX! */
                                                                BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name));
                                                                BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath));
                                                                BLI_cleanup_path(G.main->name, mainptr->curlib->filepath);
index 1b0a52313ecd39a2a6c56cf26c7df8954f1655ca..302d4da4b59f299e53b0075ecba35e220167a775 100644 (file)
@@ -1161,7 +1161,7 @@ static int gp_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op))
        }
        CTX_DATA_END;
        
-       if (v3d->around == V3D_AROUND_CENTER_MEAN) {
+       if (v3d->around == V3D_AROUND_CENTER_MEAN && count) {
                mul_v3_fl(centroid, 1.0f / (float)count);
                copy_v3_v3(cursor, centroid);
        }
index ccd1b7cb02956a93dcc5f826af3299f461ac01ba..121bf75c4a53b84685e4579e7a602f7e40fbb36f 100644 (file)
@@ -1374,7 +1374,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
                }
                else {
                        BLI_cleanup_dir(G.main->name, sfile->params->dir);
-                       strcat(sfile->params->dir, file->relpath);
+                       strncat(sfile->params->dir, file->relpath, sizeof(sfile->params->dir));
                        BLI_add_slash(sfile->params->dir);
                }
 
index 2bcd56a3ced61c63ebcdc4dd5ac62cd7ae59b4e8..771a64693e0ea8f35603bfbcee3333de8d38a597 100644 (file)
@@ -249,7 +249,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
        }
 
        if (count == 1)
-               strcpy(title, IFACE_("Unpack 1 File"));
+               BLI_strncpy(title, IFACE_("Unpack 1 File"), sizeof(title));
        else
                BLI_snprintf(title, sizeof(title), IFACE_("Unpack %d Files"), count);