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
committed by Thomas Dinges
parent 776327832d
commit 50aa9357ef
2 changed files with 8 additions and 2 deletions
@@ -302,7 +302,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);
@@ -1019,7 +1019,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);
}
}