diff options
author | Patrick Dawson <pat@dw.is> | 2022-11-14 00:47:14 +0100 |
---|---|---|
committer | Patrick Dawson <pat@dw.is> | 2022-11-14 00:47:14 +0100 |
commit | ffa39db8476a71ff4af64667ee02ff3026cb8c0b (patch) | |
tree | 972c4ee33e8c75691a3a3ecb8fb0eea44d6f5009 | |
parent | b05e1e7d6982c1a0ebbba2e1da60bf05fd2a009a (diff) |
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. |