Fix buffer overflow from passing undersized buffers to BLI_path_abs

This commit is contained in:
Campbell Barton 2024-03-28 11:40:24 +11:00
parent da49873e89
commit db466e9578
2 changed files with 8 additions and 2 deletions

View File

@ -303,7 +303,10 @@ std::string import_asset(const char *src,
src);
return src;
}
BLI_path_abs(dest_dir_path, basepath);
char path_temp[FILE_MAX];
STRNCPY(path_temp, dest_dir_path);
BLI_path_abs(path_temp, basepath);
STRNCPY(dest_dir_path, path_temp);
}
BLI_path_normalize(dest_dir_path);

View File

@ -1014,7 +1014,10 @@ static void render_result_exr_file_cache_path(Scene *sce,
BLI_path_join(r_path, FILE_CACHE_MAX, root, filename_full);
if (BLI_path_is_rel(r_path)) {
BLI_path_abs(r_path, dirname);
char path_temp[FILE_MAX];
STRNCPY(path_temp, r_path);
BLI_path_abs(path_temp, dirname);
BLI_strncpy(r_path, path_temp, FILE_CACHE_MAX);
}
}