Pre-Submission Checklist

Type Of Change

Checklist:

Description

During query operations string fields inside result structure db1_res_t could be corrupted because of incorrect usage of bson memory.

This issue is reproduced when we need to read more than 150 documents from the database. So that is why this issue still exists.

Firstly bson_iter_utf8 function returns pointer to memory which is allocated inside bson memory and which is used multiple times. So the data must be copied into Kamailio memory instead storing that pointer. The pointer becomes invalid after some time.

Secondly, this pointer must not be freed by the caller of bson_iter_utf8. At the current version bson allocated pointer is freed by Kamailio function pkg_free like it is was allocated by pkg_malloc.


You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/1508

Commit Summary

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.