Selaa lähdekoodia

Fix null pointer dereferenceThanks to Thomas Moeller for the report!

Mészáros Mihály 5 vuotta sitten
vanhempi
sitoutus
93a8c8aa78
2 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 4 0
      ChangeLog
  2. 3 2
      src/apps/relay/ns_ioalib_engine_impl.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+24/06/2020 Oleg Moskalenko <[email protected]> Mihály Mészáros <[email protected]>
+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 <[email protected]> Mihály Mészáros <[email protected]>
 Version 4.5.1.3 'dan Eider':
 	- merge PR #575: (by osterik)

+ 3 - 2
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__);
 	  }
 	}