Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-672

my_auth.c:153:5: error: 'strncpy' output may be truncated copying

    XMLWordPrintable

Details

    Description

      When building optimized ASAN builds, using GCC 11.4:

      /test/preview-11.3-preview_opt_san/libmariadb/plugins/auth/my_auth.c:153:5: error: 'strncpy' output may be truncated copying
       511 bytes from a string of length 511 [-Werror=stringop-truncation]
        153 |     strncpy(last_error, ((MCPVIO_EXT *)vio)->mysql->net.last_error,
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        154 |             sizeof(last_error) - 1);
            |             ~~~~~~~~~~~~~~~~~~~~~~~
      /test/preview-11.3-preview_opt_san/libmariadb/plugins/auth/my_auth.c:170:5: error: 'strncpy' output may be truncated copying
       511 bytes from a string of length 511 [-Werror=stringop-truncation]
        170 |     strncpy(mysql->net.last_error, last_error,
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        171 |             sizeof(mysql->net.last_error) - 1);
            |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

      May be present in other versions too.

      Attachments

        Activity

          People

            georg Georg Richter
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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