PengZheng commented on issue #723: URL: https://github.com/apache/celix/issues/723#issuecomment-1907419591
> Is text pre-allocatable? I guess not, since the caller can not predict how long a string will be. The current implementation of `jsonRpc_handleReply` is confusing in this regard. ```C if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) { void *tmp = NULL; void **out = (void **) args[i]; size_t size = 0; if (dynType_descriptorType(argType) == 't') { status = jsonSerializer_deserializeJson(argType, result, &tmp); if (tmp != NULL) { size = strnlen(((char *) *(char**) tmp), 1024 * 1024); memcpy(*out, *(void**) tmp, size); } } else { dynType_typedPointer_getTypedType(argType, &argType); status = jsonSerializer_deserializeJson(argType, result, &tmp); if (tmp != NULL) { size = dynType_size(argType); memcpy(*out, tmp, size); } } ``` How could the caller of the remote method to know the resulting `strnlen` so that he can allocate buffer large enough? I feel that the precise definitions of these types are needed at the moment to have a solid RSA implementation. @pnoltes -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org