pnoltes commented on code in PR #459: URL: https://github.com/apache/celix/pull/459#discussion_r1056364625
########## bundles/pubsub/pubsub_protocol/pubsub_protocol_lib/src/pubsub_wire_protocol_common.c: ########## @@ -62,8 +62,9 @@ static celix_status_t pubsubProtocol_createNetstring(const char* string, char** return CELIX_ENOMEM; } } - *netstringOutLength = numlen + str_len + 2; - sprintf(*netstringOut, "%zu:%s,", str_len, string); + *netstringOutLength = numlen + str_len + 2; //Note +2 for ':', ',' + int written = snprintf(*netstringOut, *netstringOutLength+1, "%zu:%s,", str_len, string); //adding +1 for '\0' Review Comment: IMO this function in its current state is too complex. I will try to refactor this using open_memstream instead of snprintf. -- 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