-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Question: parsing void * #655
Copy link
Copy link
Closed
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
Activity
Metadata
Metadata
Assignees
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Hi all,
Quick question: I am using
librdkafkato receive messages whose payload is JSON string. The library returns the payload in a non-null terminatedvoid*and provides amessage->len()to indicate how many characters/bytes are valid. Is it possible to call something like:json::parse(void*, const size_t&)?I see that the parser supports
char*type but it overruns the string's length causing an overflow ...The solutions I see are:
json::parse(void*, const size_t&)signature maybe by extending/overloadingparse(T(&) array[N] ...)}character and stopAt the moment I am using
strncpyto populate a pre-allocated buffer and terminate it properly before passing it toparse. This is an extra copy operation which could be avoided...Many thanks for this awesome library - let me know what you think,
Andreas