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

Truncation in strncpy() causes build error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.19.0
    • Affects Version/s: None
    • Component/s: Build, errors
    • Labels:
      None

      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));

       

       

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

              Created:
              Updated:
              Resolved: