diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2016-08-13 14:51:09 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2016-08-13 14:51:09 +0200 |
commit | 7447b81f87152c24c2ccfbdd7cf1c3acb233a8ec (patch) | |
tree | 5b4d89e95b2d31799715384d295c195a27a4f82b /src/gui | |
parent | 3e35df9bcefb94a2cab4c7625786f91927a6baef (diff) | |
download | weechat-7447b81f87152c24c2ccfbdd7cf1c3acb233a8ec.zip |
core: fix NULL pointer derefence in case of memory error in gui_buffer_input_buffer_init()
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-buffer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 5a0d0c861..d85f06aff 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -537,7 +537,8 @@ gui_buffer_input_buffer_init (struct t_gui_buffer *buffer) { buffer->input_buffer_alloc = GUI_BUFFER_INPUT_BLOCK_SIZE; buffer->input_buffer = malloc (GUI_BUFFER_INPUT_BLOCK_SIZE); - buffer->input_buffer[0] = '\0'; + if (buffer->input_buffer) + buffer->input_buffer[0] = '\0'; buffer->input_buffer_size = 0; buffer->input_buffer_length = 0; buffer->input_buffer_pos = 0; |