Skip to content

Conversation

@pkopylov
Copy link

The implementation of the function file_lock_write() looks slightly strange. The library function g_strdup() used inside doesn't consider the length of the duplicated data. However, the size of the data parameter is restricted by the third parameter len, so its value must limit the number of bytes copied during duplication.

That patch corrects the test function inc_counter(), but it looks suspicious to me because it terminates the character value by a zero character instead of checking how the function file_lock_write() works in case the len parameter equals one and a string is not terminated by a zero character.

@pkopylov pkopylov changed the title Fix file lock write Fix file_lock_write Apr 10, 2023
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