-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Created from smartdevicelink/sdl_core#3887
if string len >512 docString overflow
char *bson_object_to_string(BsonObject *obj, char *out) { //TODO just move the pointer rather than keep a position variable int position = 0; MapIterator iterator = emhashmap_iterator(&obj->data); MapEntry *current = emhashmap_iterator_next(&iterator); position += sprintf(out, "{ "); while (current != NULL) { BsonElement *element = (BsonElement *)current->value; position += sprintf(&out[position], "\"%s\":", current->key); switch (element->type) { case TYPE_DOCUMENT: { // docString overflow char docString[512]; position += sprintf(&out[position], "%s", bson_object_to_string(bson_object_get_object(obj, current->key), docString)); break; }
A length will need to be provided in this method in order to make sure that the buffer does not overflow.
Metadata
Metadata
Assignees
Labels
No labels