Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8248

mysqldump incorrect identifier quoting during equality comparison

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 10.1.5
    • Component/s: Scripts & Clients
    • Labels:
      None

      Description

      When performing queries like the one in get_table_structure(), that make use of schema object names as strings for equality comparison, we must make sure to format the string so as to escape any characters that might affect the query.

      Query:

        const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, "
                                      "`COLUMN_TYPE` AS `Type`, "
                                      "`IS_NULLABLE` AS `Null`, "
                                      "`COLUMN_KEY` AS `Key`, "
                                      "`COLUMN_DEFAULT` AS `Default`, "
                                      "`EXTRA` AS `Extra`, "
                                      "`COLUMN_COMMENT` AS `Comment` "
                                      "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
                                      "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
      
          /* ... snip ... */
          /* This needs to quote the identifiers db and table. quote_for_equal() does the job. */
          my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table);
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            cvicentiu Vicentiu Ciorbaru added a comment -
            Show
            cvicentiu Vicentiu Ciorbaru added a comment - CC: Sergei Golubchik
            Show
            cvicentiu Vicentiu Ciorbaru added a comment - Fixed with https://github.com/MariaDB/server/commit/3839e91223528cb3435f48e13cf4832dfd009a84

              People

              • Assignee:
                cvicentiu Vicentiu Ciorbaru
                Reporter:
                cvicentiu Vicentiu Ciorbaru
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: