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

Code improvement. Also fix compiler warning. #443

Merged
merged 2 commits into from
Feb 11, 2021

Conversation

jjnicola
Copy link
Member

@jjnicola jjnicola commented Feb 10, 2021

What:
Use a char pointer instead of an zero-lenght array as kb_redis struct member.
Use g_strdup instead of strncpy for initializing kbr->path.
Free the path where necessary.

Why:

Declaring zero-length arrays in other contexts, including as interior members of structure objects or as non-member objects, is discouraged. Accessing elements of zero-length arrays declared in such contexts is undefined and may be diagnosed.

https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

How:

Checklist:

Use a char pointer instead of an zero-lenght array as kb_redis struct member.
Use g_strdup instead of strncpy for initializing kbr->path.
Free the path where necessary.
@jjnicola
Copy link
Member Author

Close #440

@jjnicola jjnicola marked this pull request as ready for review February 10, 2021 14:01
@bjoernricks bjoernricks merged commit a34a578 into greenbone:gvm-libs-20.08 Feb 11, 2021
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.

2 participants