Some minor fixes from coverity reports.

This commit is contained in:
Bastien Montagne 2016-01-10 09:45:57 +01:00
parent 0372b64270
commit e9c8e0316f
Notes: blender-bot 2023-02-14 10:21:10 +01:00
Referenced by issue #47162, Hide curve in the graph editor malfuctioning
4 changed files with 4 additions and 4 deletions

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

View 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);
}

View 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);
}

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