Fix wrong pointers in memcpy of pubnub_generate_uuid_v1_time() #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey guys, my compiler was complaining about this memcpy call.
Here in line 49 of core/pubnub_generate_uuid.c it seems like the goal is to copy the content of the array uint8_t const i_node[6] into the array ud->node, both with the length of 6 bytes. Since both i_node and ud->node are already pointers to a memory area with each 6 bytes, I assume the use of '&' was a mistake. If the goal really was to copy the pointers and not the content of the memory area, then surely the size must be something like "sizeof(uint8_t*)". But the way it is right now my compiler is complaining that the sizes differ (I'm compiling for a 32bit system):
../c-core/core/pubnub_generate_uuid.c:49:5: error: 'memcpy' reading 6 bytes from a region of size 4 [-Werror=stringop-overflow=] memcpy(&ud->node, &i_node, sizeof ud->node);