Skip to content
Snippets Groups Projects
Commit 9f15ee3c authored by Campbell Barton's avatar Campbell Barton Committed by Philipp Oeser
Browse files

Fix T96691: Heap corruption in file_browse_exec

Regression in [0], also use pad buffer by 1 instead of 2 which is no
longer needed as the trailing slash is no longer added
after allocating the string.

0682af0d
parent c33870ab
No related branches found
No related tags found
No related merge requests found
......@@ -222,13 +222,13 @@ static int file_browse_exec(bContext *C, wmOperator *op)
/* Do this first so '//' isn't converted to '//\' on windows. */
BLI_path_slash_ensure(path);
if (is_relative) {
const int path_len = BLI_strncpy_rlen(path, str, FILE_MAX);
BLI_path_rel(path, BKE_main_blendfile_path(bmain));
str = MEM_reallocN(str, path_len + 2);
BLI_strncpy(str, path, FILE_MAX);
str_len = strlen(path);
str = MEM_reallocN(str, str_len + 1);
memcpy(str, path, str_len + 1);
}
else {
str = MEM_reallocN(str, str_len + 2);
str = MEM_reallocN(str, str_len + 1);
}
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment