Fix potential buffer read overflow in the splash screen

Since [0], checking if the user preferences exists used an uninitialized
string in the unlikely situation that the users configuration directory
couldn't be found.

[0]: 0c62906a41
This commit is contained in:
Campbell Barton
2024-04-23 16:09:46 +10:00
parent ce05eb98c9
commit edfba89d1e

View File

@@ -245,9 +245,12 @@ static uiBlock *wm_block_splash_create(bContext *C, ARegion *region, void * /*ar
if (cfgdir.has_value()) {
BLI_path_join(userpref, sizeof(userpref), cfgdir->c_str(), BLENDER_USERPREF_FILE);
}
else {
userpref[0] = '\0';
}
/* Draw setup screen if no preferences have been saved yet. */
if (!BLI_exists(userpref)) {
if (!(userpref[0] && BLI_exists(userpref))) {
mt = WM_menutype_find("WM_MT_splash_quick_setup", true);
/* The #UI_BLOCK_QUICK_SETUP flag prevents the button text from being left-aligned,