Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-348

Incorrect use of strncat

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.1, 1.2.0, 1.3.0, 1.4.0
    • 2.1.0
    • Core
    • None
    • All
    • 2016-12, 2016-13, 2016-15

    Description

      The function strncat is used 29 times at present, and appears to be subject to a widespread misunderstanding. The function does NOT limit the length of the result to the value of the final parameter. It limits the number of characters added to the value of the final parameter. So, a safe use of strncat would be:
      strncat(str1, str2, sizeof(str1) - sizeof(str2) - 1);
      I am not recommending that exact construction, simply giving it as an illustration of correct use of the size limit in strncat.

      Attachments

        Issue Links

          Activity

            People

              johan.wikman Johan Wikman
              martin brampton martin brampton (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.