File 5982-Bugfix-skip-the-value-when-skipping-the-option.patch of Package erlang

From 9ebdfbf26470d7f57fe5a9136bb19cee641ba96e Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Mon, 23 Sep 2024 14:27:58 +0200
Subject: [PATCH 2/2] Bugfix: skip the value when skipping the option

---
 erts/emulator/drivers/common/inet_drv.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index f10820653c..06bee698c6 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -8129,6 +8129,7 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
 	    arg_sz  = sizeof  ( arg.ival);
 	    break;
 #else
+            curr += 4;
             continue;
 #endif
 
@@ -8139,6 +8140,7 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
                   "sctp_set_opts -> REUSEPORT_LB\r\n",
                   __LINE__, desc->s, driver_caller(desc->port)) );
 #if defined(__WIN32__)
+            curr += 4;
             continue;
 #elif defined(SO_REUSEPORT_LB) || (defined(__linux__) && defined(SO_REUSEPORT))
 	    arg.ival= get_int32 (curr);	  curr += 4;
@@ -8153,6 +8155,7 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
 	    arg_sz  = sizeof  ( arg.ival);
 	    break;
 #else
+            curr += 4;
             continue;
 #endif
 	}
@@ -8173,6 +8176,7 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
 	    arg_sz  = sizeof  ( arg.ival);
 	    break;
 #else
+            curr += 4;
             continue;
 #endif
 	}
@@ -8204,8 +8208,10 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
                 }
                 new_ra = (compat & ra_bits) == ra_bits;
                 desc->bsd_compat = compat;
-                if (old_ra == new_ra)
+                if (old_ra == new_ra) {
+                    curr += 4;
                     continue;
+                }
             }
 #endif
 	    arg.ival= get_int32 (curr);	  curr += 4;
@@ -8252,7 +8258,8 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
 #	else
         /* inet_fill_opts always returns a value for this option,
          * so we need to ignore it if not implemented, just in case */
-	    continue;
+            curr += 4;
+            continue;
 #	endif
 
 	case INET_OPT_TOS:
@@ -8274,7 +8281,8 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
 #	else
         /* inet_fill_opts always returns a value for this option,
          * so we need to ignore it if not implemented, just in case */
-	    continue;
+            curr += 4;
+            continue;
 #	endif
 
 #       if defined(IPV6_TCLASS) && defined(IPPROTO_IPV6)
@@ -8405,7 +8413,8 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len)
 #       elif defined(__WIN32__) && defined(HAVE_IN6) && defined(AF_INET6)
 #           error Here is a fix for Win IPv6 SCTP missing
 #       else
-	    continue; /* Option not supported -- ignore it */
+	    curr += 4;
+            continue; /* Option not supported -- ignore it */
 #       endif
 
 #ifdef SO_BINDTODEVICE
-- 
2.43.0

openSUSE Build Service is sponsored by