Truncation in strncpy() causes build error

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 1.19.0
    • Affects Version/s: None
    • Component/s: Build, errors
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 (Inactive)
              Reporter:
              Jesse Williamson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: