Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong pointers in memcpy of pubnub_generate_uuid_v1_time() #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarcGeh
Copy link
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