File 5907-Fix-NULL-pointer-to-memmove-in-tcp_deliver.patch of Package erlang

From fbafeda9f6565e4fbdfaa8ecb47b6a40376ea96f Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Fri, 30 Aug 2024 15:07:47 +0200
Subject: [PATCH 7/7] Fix NULL pointer to memmove in tcp_deliver

This reverts commit 45ebcd3671a7d51aba21847f9a22a8b985185a99.
---
 erts/emulator/drivers/common/inet_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 28c46bd269..dbdc29310e 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -11408,6 +11408,7 @@ static void tcp_restart_input(tcp_descriptor* desc)
 	int n;
 
         ASSERT( (desc->i_ptr_start != NULL) &&
+                (desc->i_buf != NULL) &&
                 (desc->i_buf->orig_bytes != NULL) );
 
         n = desc->i_ptr - desc->i_ptr_start;
@@ -12580,8 +12581,10 @@ static int tcp_remain(tcp_descriptor* desc, int* len)
 
         *len = 0;
         nread = packet_header_length(desc);
-        if (nread != 0)
+        if (nread != 0) {
+            tcp_restart_input(desc); /* Move the data to buffer start */
             return nread;
+        }
 
         if (nsz == 0) { /* No remaining space - buffer is full */
             if (nfill == n) {   /* The current packet itself fills the buffer */
-- 
2.43.0

openSUSE Build Service is sponsored by