summaryrefslogtreecommitdiff
path: root/sql/mf_iocache_encr.cc
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2021-04-06 12:52:44 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2021-04-06 12:52:44 +0200
commitc030f4c625b90baa17cb8c73a018a327aa12b557 (patch)
tree25466f53c50fc7d92e0b17f04c206f3ccf59eb47 /sql/mf_iocache_encr.cc
parent28b76afceac1eb2c35e77439142daac53908cdc3 (diff)
parent6fe624b5acf51383d39eb0e547a03779d41cf4a8 (diff)
downloadmariadb-git-c030f4c625b90baa17cb8c73a018a327aa12b557.tar.gz
Commit last pull from origin
Diffstat (limited to 'sql/mf_iocache_encr.cc')
-rw-r--r--sql/mf_iocache_encr.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index 29d7074aeb1..434ae08fde0 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2015, MariaDB
+ Copyright (c) 2015, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -85,7 +85,6 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
do
{
- size_t copied;
uint elength, wlength, length;
uchar iv[MY_AES_BLOCK_SIZE]= {0};
@@ -116,11 +115,13 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
DBUG_ASSERT(length <= info->buffer_length);
- copied= MY_MIN(Count, (size_t)(length - pos_offset));
-
- memcpy(Buffer, info->buffer + pos_offset, copied);
- Count-= copied;
- Buffer+= copied;
+ size_t copied= MY_MIN(Count, (size_t)(length - pos_offset));
+ if (copied)
+ {
+ memcpy(Buffer, info->buffer + pos_offset, copied);
+ Count-= copied;
+ Buffer+= copied;
+ }
info->read_pos= info->buffer + pos_offset + copied;
info->read_end= info->buffer + length;