Browse code

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.

S-P Chan authored on 23/06/2022 02:10:11
Showing 1 changed files
... ...
@@ -243,7 +243,7 @@ static void* ser_realloc(void *ptr, size_t new_size)
243 243
 	*(size_t*)new_ptr = new_size;
244 244
 	int new_pad = MAX_ALIGN - ((long) new_ptr % MAX_ALIGN);
245 245
 	if (new_pad != pad) {
246
-		memmove(new_ptr + MAX_ALIGN + new_pad, new_ptr + MAX_ALIGN + pad, size);
246
+		memmove(new_ptr + MAX_ALIGN + new_pad, new_ptr + MAX_ALIGN + pad, new_size);
247 247
 		memset(new_ptr + MAX_ALIGN, new_pad, new_pad);
248 248
 	}
249 249