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 memory allocation for wpe_pasteboard_string #42

Merged
merged 1 commit into from May 8, 2019

Conversation

2 participants
@aperezdc
Copy link
Contributor

commented Mar 2, 2019

The data member of wpe_pasteboard_string is a dynamically allocated array of characters, the allocated size must be sizeof(char) * in_length. Also, calloc() already computes the final size itself, so pass the in_length parameter as the number of elements, and sizeof(char) as the element size.

@aperezdc aperezdc added the bug label Mar 2, 2019

@aperezdc aperezdc requested review from zdobersek and carlosgcampos Mar 2, 2019

Fix memory allocation for wpe_pasteboard_string
The "data" member of wpe_pasteboard_string is a dynamically allocated
array of characters, and allocated size must be "sizeof(char) * in_length".
Also, calloc() already computes the final size itself, so pass the
"in_length" parameter as the number of elements, and "sizeof(char)" as
the element size.

@aperezdc aperezdc force-pushed the fix-pasteboard-alloc branch from 6ea3995 to 44cb5a3 Mar 2, 2019

@aperezdc aperezdc merged commit ec8acc9 into master May 8, 2019

@aperezdc aperezdc deleted the fix-pasteboard-alloc branch May 8, 2019

@aperezdc

This comment has been minimized.

Copy link
Contributor Author

commented May 9, 2019

I have also cherry-picked this into the libwpe-1.2 branch, as commit 2d001a1 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.