Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4091

Truncation in strncpy() causes build error

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Unknown Unknown
    • 1.19.0
    • None
    • Build, errors
    • None

    Description

      gcc complains that because the destination length is computed based on the source string, the trailing NULL won't be copied:

      test->cursor_ns = (char *) bson_malloc0 (strlen (temp));
      strncpy (test->cursor_ns, temp, strlen (temp));

       

       

      Attachments

        Activity

          People

            jesse.williamson@mongodb.com Jesse Williamson (Inactive)
            jesse.williamson@mongodb.com Jesse Williamson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: