[sr-dev] git:master:4484a5eb: tls_wolfssl: ser_realloc realign memory correctly to 16-bytes

S-P Chan shihping.chan at gmail.com
Thu Jun 23 04:11:58 CEST 2022


Module: kamailio
Branch: master
Commit: 4484a5eb9e0dd6e6723390cb96c378f88f1fd074
URL: https://github.com/kamailio/kamailio/commit/4484a5eb9e0dd6e6723390cb96c378f88f1fd074

Author: S-P Chan <shihping.chan at gmail.com>
Committer: S-P Chan <shihping.chan at gmail.com>
Date: 2022-06-23T10:10:11+08:00

tls_wolfssl: ser_realloc realign memory correctly to 16-bytes

If shm_realloc returns a different 8/16 byte alignment we
need to memmove the correct amount.

---

Modified: src/modules/tls_wolfssl/tls_init.c

---

Diff:  https://github.com/kamailio/kamailio/commit/4484a5eb9e0dd6e6723390cb96c378f88f1fd074.diff
Patch: https://github.com/kamailio/kamailio/commit/4484a5eb9e0dd6e6723390cb96c378f88f1fd074.patch

---

diff --git a/src/modules/tls_wolfssl/tls_init.c b/src/modules/tls_wolfssl/tls_init.c
index 1fcac5549d..9993c4a3d5 100644
--- a/src/modules/tls_wolfssl/tls_init.c
+++ b/src/modules/tls_wolfssl/tls_init.c
@@ -243,7 +243,7 @@ static void* ser_realloc(void *ptr, size_t new_size)
 	*(size_t*)new_ptr = new_size;
 	int new_pad = MAX_ALIGN - ((long) new_ptr % MAX_ALIGN);
 	if (new_pad != pad) {
-		memmove(new_ptr + MAX_ALIGN + new_pad, new_ptr + MAX_ALIGN + pad, size);
+		memmove(new_ptr + MAX_ALIGN + new_pad, new_ptr + MAX_ALIGN + pad, new_size);
 		memset(new_ptr + MAX_ALIGN, new_pad, new_pad);
 	}
 		




More information about the sr-dev mailing list