MENT-2388 MDEV-37518 Check number of fields in mysql.servers before trying to read Options

Also added a test covering MDEV-36087

This is a followup of 6f1161aa34
This commit is contained in:
Yuchen Pei 2025-09-04 11:05:54 +10:00
commit d203a8a5df
No known key found for this signature in database
GPG key ID: 3DD1B35105743563
3 changed files with 39 additions and 1 deletions

View file

@ -473,7 +473,7 @@ get_server_from_table_to_cache(TABLE *table)
server->scheme= ptr ? ptr : blank;
ptr= get_field(&mem, table->field[8]);
server->owner= ptr ? ptr : blank;
ptr= table->field[9] ? get_field(&mem, table->field[9]) : NULL;
ptr= table->s->fields > 9 ? get_field(&mem, table->field[9]) : NULL;
server->option_list= NULL;
if (ptr && parse_server_options_json(server, ptr))
DBUG_RETURN(TRUE);