diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-14 11:08:22 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-14 11:08:22 +0100 |
commit | 1b3ed1b3baa442c090981e3880f15d68d44bfbf3 (patch) | |
tree | 755e47d5526314c3b152faa9aa36dd4bc50b2acb | |
parent | 193f070cbc51ebb4e6ca1f2781b7d911401518f9 (diff) | |
parent | ffa39db8476a71ff4af64667ee02ff3026cb8c0b (diff) |
Merge pull request #68631 from pkdawson/fix-icondir-buffer-overflow
Fix ICONDIR buffer overflow
-rw-r--r-- | platform/windows/display_server_windows.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index ec6a8d5579..af80a07da9 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1892,7 +1892,7 @@ void DisplayServerWindows::set_native_icon(const String &p_filename) { pos += sizeof(WORD); f->seek(pos); - icon_dir = (ICONDIR *)memrealloc(icon_dir, 3 * sizeof(WORD) + icon_dir->idCount * sizeof(ICONDIRENTRY)); + icon_dir = (ICONDIR *)memrealloc(icon_dir, sizeof(ICONDIR) - sizeof(ICONDIRENTRY) + icon_dir->idCount * sizeof(ICONDIRENTRY)); f->get_buffer((uint8_t *)&icon_dir->idEntries[0], icon_dir->idCount * sizeof(ICONDIRENTRY)); int small_icon_index = -1; // Select 16x16 with largest color count. |