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

Replace sprintf with snprintf in the InnoDB binlog code due to deprecation

    XMLWordPrintable

Details

    Description

      I get the following warning when compiling on MacOSX with clang:

      [build] In file included from /Users/gkodinov/dev/server-main/extra/mariabackup/backup_copy.cc:64:
      [build] /Users/gkodinov/dev/server-main/storage/innobase/include/innodb_binlog.h:254:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
      [build]   254 |   sprintf(name_buf, BINLOG_NAME_BASE "%06" PRIu64 BINLOG_NAME_EXT, file_no);
      [build]       |   ^
      

      Note that snprintf() is not appropriate as a replacement, as it silently truncates the result, causing silent data corruption.

      Attachments

        Issue Links

          Activity

            People

              gkodinov Georgi Kodinov
              gkodinov Georgi Kodinov
              Georgi Kodinov Georgi Kodinov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.