Skip to content

Commit

Permalink
Fix NULL pointer to memmove in tcp_deliver
Browse files Browse the repository at this point in the history
This reverts commit 45ebcd3671a7d51aba21847f9a22a8b985185a99.
  • Loading branch information
RaimoNiskanen committed Aug 30, 2024
1 parent e806202 commit fbafeda
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion erts/emulator/drivers/common/inet_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit fbafeda

Please sign in to comment.