diff options
author | Mario Campos <mario-campos@github.com> | 2024-03-08 23:11:30 -0600 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-13 09:09:29 +0100 |
commit | f76d23601543eee605be848f8607bf0ba52c2e5f (patch) | |
tree | 0542f1470c66bddc02816d70ec02d7afffad360a /src/gui/curses/gui-curses-color.c | |
parent | 1797fe18a39d61eb19f19dc868bbc1dd988073a4 (diff) | |
download | weechat-f76d23601543eee605be848f8607bf0ba52c2e5f.zip |
GUI: fix potential integer overflow bugs by casting to `size_t`
Diffstat (limited to 'src/gui/curses/gui-curses-color.c')
-rw-r--r-- | src/gui/curses/gui-curses-color.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index 705986be2..af71bfd9a 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -669,7 +669,7 @@ gui_color_init_vars () gui_color_num_pairs = (gui_color_term_color_pairs >= 32768) ? 32767 : gui_color_term_color_pairs - 1; gui_color_pairs = calloc ( - (gui_color_term_colors + 2) * (gui_color_term_colors + 2), + (size_t)(gui_color_term_colors + 2) * (gui_color_term_colors + 2), sizeof (gui_color_pairs[0])); gui_color_pairs_used = 0; @@ -1226,7 +1226,7 @@ gui_color_reset_pairs () if (gui_color_pairs) { memset (gui_color_pairs, 0, - (gui_color_term_colors + 2) + (size_t)(gui_color_term_colors + 2) * (gui_color_term_colors + 2) * sizeof (gui_color_pairs[0])); gui_color_pairs_used = 0; |