From f41fe7bb0447dfbf16d3b6df124d3b04c657ac9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20G=C3=BCndo=C4=9Fan?= Date: Tue, 3 Jun 2014 21:57:55 +0200 Subject: [PATCH] destiny: segfault due to dereferencing nullpointer get_socket(i) returns NULL, when no specific socket is found. Without an appropriate check for NULL, the current state of the code leads to a segfault. destiny: added parens destiny: continuing the loop makes more sense than returning at first sight of NULL --- sys/net/transport_layer/destiny/socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/net/transport_layer/destiny/socket.c b/sys/net/transport_layer/destiny/socket.c index 702e7d9bf1..d6a342466e 100644 --- a/sys/net/transport_layer/destiny/socket.c +++ b/sys/net/transport_layer/destiny/socket.c @@ -1194,6 +1194,10 @@ socket_internal_t *get_waiting_connection_socket(int socket, for (i = 1; i < MAX_SOCKETS + 1; i++) { current_socket = get_socket(i); + if (!current_socket) { + continue; + } + /* Connection establishment ACK, Check for 4 touple and state */ if ((ipv6_header != NULL) && (tcp_header != NULL)) { if (is_four_touple(current_socket, ipv6_header, tcp_header) &&