FreeRADIUS/freeradius-server — pull request #835 by qnet-herwin (2014-11-17 17:02:02+00:00)
Title: Fixed off-by-two error in json module

When using rlm_rest with JSON requests, the bug was triggered if the value including the trailing JSON data was at a chunk boundary (eg, when the closing `}` of the value was at position 1023). The bug was pretty rare to trigger, and resulted in omission of the value in the JSON data.

Most likely the cause of this bug was code reuse from other parts, but when calculating the free space the trailing JSON data wasn't accounted for. I haven't been able to reproduce the bug with this patch.

I haven't tested this with the master branch, but I assume the problem exists there as well.