From 791b130291d8355382a57330e6a807ff5e69a6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 25 Feb 2010 13:21:40 +0000 Subject: [PATCH] * Fixed a possible NULL pointer access in case the list is empty. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35615 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/stack/net_buffer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/add-ons/kernel/network/stack/net_buffer.cpp b/src/add-ons/kernel/network/stack/net_buffer.cpp index f80d1db106..40c87453a7 100644 --- a/src/add-ons/kernel/network/stack/net_buffer.cpp +++ b/src/add-ons/kernel/network/stack/net_buffer.cpp @@ -974,11 +974,8 @@ static inline data_node* get_node_at_offset(net_buffer_private* buffer, size_t offset) { data_node* node = (data_node*)list_get_first_item(&buffer->buffers); - while (node->offset + node->used <= offset) { + while (node != NULL && node->offset + node->used <= offset) node = (data_node*)list_get_next_item(&buffer->buffers, node); - if (node == NULL) - return NULL; - } return node; }