URL:
https://github.com/SSSD/sssd/pull/542
Title: #542: KCM: Use json_loadb() when dealing with sss_iobuf data
pbrezina commented:
"""
Simple fix: given the use cases, we can make `tcurl_http_recv` to ensure that data are
NULL-terminated.
Technically correct fix:
`sss_iobuf_get_data` which is used here returns binary data, not a string. So it is
perfectly fine to return non NULL-terminated data here. There is `sss_iobuf_read_stringz`
which should be used instead to read string, but it won't help if the data is not
already NULL-terminated.
So there should be a way (new iobuf function possibly) to return `strndup(buf, len)`.
BTW, current implementation of `sss_iobuf_read_stringz` is not very safe as we can simple
access data outside our buffer in `memchr`.
"""
See the full comment at
https://github.com/SSSD/sssd/pull/542#issuecomment-375266315