summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2016-03-21 17:47:15 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2016-03-22 22:20:33 +0200
commit16ddd1824c679751deb0ab89b40c1375f6540c3f (patch)
tree10be18476293a170d0a91f945d57929226155b02 /plugin
parent8e048579cdafd6656ebc7dd5bee919c0899e4d7d (diff)
downloadmariadb-git-16ddd1824c679751deb0ab89b40c1375f6540c3f.tar.gz
MDEV-9613: keyfile without any keys crashes mysqld on loading file_key_management plugin
Code was assuming that the keys file would contain at least one valid key. This caused a Dynamic_array::at(0) call that lead to the crash.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/file_key_management/parser.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc
index 28cd981df79..628412bc171 100644
--- a/plugin/file_key_management/parser.cc
+++ b/plugin/file_key_management/parser.cc
@@ -220,7 +220,7 @@ bool Parser::parse_file(Dynamic_array<keyentry> *keys, const char *secret)
keys->sort(sort_keys);
my_free(buffer);
- if (keys->at(0).id != 1)
+ if (keys->elements() == 0 || keys->at(0).id != 1)
{
report_error("System key id 1 is missing", 0);
return 1;