Skip to content

Fix wrong pointers in memcpy of pubnub_generate_uuid_v1_time()#106

Open
MarcGeh wants to merge 1 commit intopubnub:masterfrom
MarcGeh:master
Open

Fix wrong pointers in memcpy of pubnub_generate_uuid_v1_time()#106
MarcGeh wants to merge 1 commit intopubnub:masterfrom
MarcGeh:master

Conversation

@MarcGeh
Copy link
Copy Markdown
Contributor

@MarcGeh MarcGeh commented Nov 24, 2020

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant