From 0f2f30f3f4ba936d7adb14a194cea85b12203619 Mon Sep 17 00:00:00 2001
From: Chad Wagner <47257594+wagnerch@users.noreply.github.com>
Date: Sat, 21 Oct 2023 07:35:57 -0400
Subject: [PATCH 1/2] Fix "Bad handshake" issue introduced by CONC-668 on
 32-bit platforms.

Cast size_t to ulonglong on call to int8store.  On 64-bit platforms they are both 8 bytes,
and on 32-bit platforms size_t is 4 bytes.
---
 libmariadb/mariadb_stmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c
index 1f4782e2291e..927cba8588ac 100644
--- a/libmariadb/mariadb_stmt.c
+++ b/libmariadb/mariadb_stmt.c
@@ -511,7 +511,7 @@ unsigned char *mysql_net_store_length(unsigned char *packet, size_t length)
     return packet + 3;
   }
   *packet++ = 254;
-  int8store(packet, length);
+  int8store(packet,(ulonglong) length);
   return packet + 8;
 }
 
-- 
2.34.1


From 91699d7a63bd4cc77dc19af1c32cc9cd289511fd Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Sat, 23 Sep 2023 23:24:30 +1000
Subject: [PATCH 2/2] Additional fix for CONC-668:

Fix build error on 32-bit systems.
---
 libmariadb/ma_context.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libmariadb/ma_context.c b/libmariadb/ma_context.c
index 94a406684bbc..fc8380a047cf 100644
--- a/libmariadb/ma_context.c
+++ b/libmariadb/ma_context.c
@@ -90,6 +90,8 @@ my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
 {
   int err;
   union pass_void_ptr_as_2_int u;
+  u.a[0]= 0;
+  u.a[1]= 0;
 
   err= getcontext(&c->spawned_context);
   if (err)
-- 
2.34.1

