mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
Fix encryption calls with overlapping buffers
Allocate a temporary buffer instead of using the same buffer in some cases, and add assertions to verify the buffers do not overlap. See [1] for reasonsing. [1] https://github.com/MariaDB/server/pull/2438#discussion_r1137403645 Signed-off-by: Trevor Gross <tmgross@umich.edu>
This commit is contained in:
committed by
Sergei Golubchik
parent
b91d5bcedc
commit
dbc3429592
@@ -60,6 +60,10 @@ static inline int encryption_crypt(const unsigned char* src, unsigned int slen,
|
||||
unsigned int d1, d2= *dlen;
|
||||
assert(*dlen >= slen);
|
||||
assert((dst[*dlen - 1]= 1));
|
||||
if (src < dst)
|
||||
assert(src + slen <= dst);
|
||||
else
|
||||
assert(dst + *dlen <= src);
|
||||
if ((res1= encryption_handler.encryption_ctx_init_func((ctx),(key),(klen),(iv),(ivlen),(flags),(key_id),(key_version))))
|
||||
return res1;
|
||||
res1= encryption_handler.encryption_ctx_update_func((ctx),(src),(slen),(dst),(&d1));
|
||||
|
Reference in New Issue
Block a user