summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 16:24:47 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 16:24:47 +0200
commit133b4b46fefde402542214d8226262534dc3601a (patch)
tree51bbdc0ee35a4af61e5af6d97948963ae9354f39 /plugin
parent44836bcd12e3974e79c928be747955bfb3b73910 (diff)
parent533a13af069d8c9e6c5f4e1a72851497185ade03 (diff)
downloadmariadb-git-133b4b46fefde402542214d8226262534dc3601a.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'plugin')
-rw-r--r--plugin/server_audit/server_audit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index bd630a16eb7..87f53b1db87 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -709,6 +709,8 @@ static char *coll_search(struct user_coll *c, const char *n, size_t len)
{
struct user_name un;
struct user_name *found;
+ if (!c->n_users)
+ return 0;
un.name_len= len;
un.name= (char *) n;
found= (struct user_name*) bsearch(&un, c->users, c->n_users,
@@ -739,7 +741,8 @@ static int coll_insert(struct user_coll *c, char *n, size_t len)
static void coll_sort(struct user_coll *c)
{
- qsort(c->users, c->n_users, sizeof(c->users[0]), cmp_users);
+ if (c->n_users)
+ qsort(c->users, c->n_users, sizeof(c->users[0]), cmp_users);
}
@@ -970,7 +973,8 @@ static void get_str_n(char *dest, int *dest_len, size_t dest_size,
if (src_len >= dest_size)
src_len= dest_size - 1;
- memcpy(dest, src, src_len);
+ if (src_len)
+ memcpy(dest, src, src_len);
dest[src_len]= 0;
*dest_len= (int)src_len;
}