From 93a8c8aa782e2862054207b472401fd8bae411bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20Mih=C3=A1ly?= Date: Thu, 2 Jul 2020 12:45:16 +0200 Subject: [PATCH] Fix null pointer dereferenceThanks to Thomas Moeller for the report! --- ChangeLog | 4 ++++ src/apps/relay/ns_ioalib_engine_impl.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 218d6f46..5307220a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +24/06/2020 Oleg Moskalenko Mihály Mészáros +Version 4.5.2 'dan Eider': + - Fix null pointer dereference in case of out of memory. (thanks to Thomas Moeller for the report) + 24/06/2020 Oleg Moskalenko Mihály Mészáros Version 4.5.1.3 'dan Eider': - merge PR #575: (by osterik) diff --git a/src/apps/relay/ns_ioalib_engine_impl.c b/src/apps/relay/ns_ioalib_engine_impl.c index 22cc640a..f7f72b51 100644 --- a/src/apps/relay/ns_ioalib_engine_impl.c +++ b/src/apps/relay/ns_ioalib_engine_impl.c @@ -293,8 +293,9 @@ static stun_buffer_list_elem *new_blist_elem(ioa_engine_handle e) if(!ret) { ret = (stun_buffer_list_elem *)malloc(sizeof(stun_buffer_list_elem)); - ret->next = NULL; - if (!ret) { + if (ret) { + ret->next = NULL; + } else { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Cannot allocate memory for STUN buffer!\n", __FUNCTION__); } }