Skip to content

Commit

Permalink
Revert "MDEV-25343 add read secret size in file key plugin"
Browse files Browse the repository at this point in the history
This reverts commit cee7175.
  • Loading branch information
grooverdan committed Oct 19, 2022
1 parent cee7175 commit 3a62ff7
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 33 deletions.
10 changes: 0 additions & 10 deletions mysql-test/suite/encryption/r/filekeys_secret_too_long.result

This file was deleted.

4 changes: 0 additions & 4 deletions mysql-test/suite/encryption/t/filekeys-data-too-long.key

This file was deleted.

3 changes: 0 additions & 3 deletions mysql-test/suite/encryption/t/filekeys_secret_too_long.opt

This file was deleted.

4 changes: 0 additions & 4 deletions mysql-test/suite/encryption/t/filekeys_secret_too_long.test

This file was deleted.

13 changes: 1 addition & 12 deletions plugin/file_key_management/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,13 @@ bool Parser::read_filekey(const char *filekey, char *secret)
return 1;
}

int len= read(f, secret, MAX_SECRET_SIZE + 1);
int len= read(f, secret, MAX_SECRET_SIZE);
if (len <= 0)
{
my_error(EE_READ,ME_ERROR_LOG, filekey, errno);
close(f);
return 1;
}

if (len > MAX_SECRET_SIZE)
{
my_printf_error(EE_READ,
"Cannot decrypt %s, the secret file has incorrect length, "
"max secret size is %dB ",
ME_ERROR_LOG, filekey, MAX_SECRET_SIZE);
close(f);
return 1;
}

close(f);
while (secret[len - 1] == '\r' || secret[len - 1] == '\n') len--;
secret[len]= '\0';
Expand Down

0 comments on commit 3a62ff7

Please sign in to comment.