Explicitly mark len parameter as (in)
The generated gir file marks the len parameter as "out" by default. This is wrong in the context of a caller allocated buffer with a given size. Explicitly marking the len parameter as (in) fixes the issue.
There is an upstream issue which suggests using an explicit annotation in this case.