Description
The bson_as_json function has a shortcut for an empty object, which has this code:
if (bson_empty0 (bson)) {
|
if (length) {
|
*length = 2;
|
}
|
|
|
return bson_strdup ("{ }");
|
}
|
https://github.com/mongodb/libbson/blob/master/src/bson/bson.c#L2672
As you can see, the returned string is three characters long, but we only return 2 as the output length. It should be 3.