-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON RPC responses are limited in size by size of pre-defined buffer #294
Comments
We can return a heap-allocated buffer and ask user to free it. |
But where we will the heap allocated buffer be returned from? I was thinking maybe a |
yeah, that approach stinks a little bit. |
PS: sorry if this was posted twice. |
@oranjuice yes that's right. Let's change the signature of dispatch function, from
to
The handler can print to the IO buffer directly. |
That looks good! |
The workflow of using fossa as a JSON RPC server as per the example requires the creation of a buffer for the response to be filled into:
https://github.com/cesanta/fossa/blob/master/examples/json_rpc_server/json_rpc_server.c#L36
The problem here is that the size of a response can be really huge or really small depending on the method called or even the parameters passed to the same method. Pro-actively allocating a large buffer can be a needless waste of memory whereas allocating a small buffer can lead to buffer overflows.
Is there a way around this?
The text was updated successfully, but these errors were encountered: