diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-02 15:48:47 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-02 15:48:47 +0200 |
commit | c7f322c91faf97a9f758c288b38e1385fd89b32d (patch) | |
tree | cf2a4cf562acffdf5b4b96d84e34f29c7f428458 /plugin | |
parent | d5ce7824444b7491f420061076ae5087d4829428 (diff) | |
parent | 8036d0a3590dddf4d51ba02bc74ba3a5a96674f7 (diff) | |
download | mariadb-git-c7f322c91faf97a9f758c288b38e1385fd89b32d.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/server_audit/server_audit.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 6badbbfedf7..bb80e7aa74b 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -708,6 +708,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, @@ -738,7 +740,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); } @@ -969,7 +972,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; } |