Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-5460

Error strings should escape embedded strings

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: 2.0.3
    • Component/s: Shell
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      > db.test.ensureIndex(

      {x:1}

      ,

      {unique:true}

      )
      > db.test.insert(

      {'x': 'y\u0000a'}

      )
      > db.test.insert(

      {'x': 'y\u0000a'}

      )
      E11000 duplicate key error index: test.test.$x_1 dup key: { : "y

      The "y\0a" string has an embedded \0, which is being inserted literally into the E11000 error, causing it to be truncated at some point later.

      Error message strings from the server should probably be escaped to not contain embedded nulls, so it doesn't need to be dealt with in each driver.

            Assignee:
            geert.bosch@mongodb.com Geert Bosch
            Reporter:
            glenn Glenn Maynard
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: