1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-18 23:03:28 +03:00

MDEV-28315 Fix ASAN stack-buffer-overflow in String::copy_aligned

Starting since this commit 36cdd5c3cd
there is an ASAN stack-buffer-overflow error because we append a NULL
terminator beyond the length of memory allocated.

Reviewed by: Monty and Nayuta Yanagisawa
This commit is contained in:
Norio Akagi
2022-08-01 04:27:33 -07:00
committed by GitHub
parent 63478e72de
commit 84d26f98c7
4 changed files with 24 additions and 2 deletions

View File

@ -690,7 +690,7 @@ public:
Note that if arg_length == Alloced_length then we don't allocate.
This ensures we don't do any extra allocations in protocol and String:int,
but the string will not be atomically null terminated if c_ptr() is not
but the string will not be automatically null terminated if c_ptr() is not
called.
*/
if (arg_length <= Alloced_length && Alloced_length)