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

Statement might be overflowing a buffer in strncat

Details

    Description

      Our checker detected a probable buffer overflow in strncat call (storage/connect/reldef.cpp:503:63):

      [ 3291s] I: Statement might be overflowing a buffer in strncat. Common mistake:
      [ 3291s] BAD: strncat(buffer,charptr,sizeof(buffer)) is wrong, it takes the left over size as 3rd argument
      [ 3291s] GOOD: strncat(buffer,charptr,sizeof(buffer)-strlen(buffer)-1)
      [ 3291s] E: mariadb bufferoverflowstrncat /home/abuild/rpmbuild/BUILD/mariadb-10.2.29/storage/connect/reldef.cpp:503:63

      There are probably more of such strncat calls in the MariaDB server so it would be wise to revise all of them.

      Attachments

        Activity

          Thanks for spotting this error. BTW I fixed a couple of similar errors.

          bertrandop Olivier Bertrand added a comment - Thanks for spotting this error. BTW I fixed a couple of similar errors.

          People

            bertrandop Olivier Bertrand
            kstreitova Kristyna Streitova
            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.