Skip to content
New issue

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

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

Already on GitHub? # to your account

Use correct type size for port elements #392

Merged
merged 2 commits into from
Aug 27, 2020

Conversation

ArnoStiefvater
Copy link
Member

What:

Fix type conversion bug. Because of this bug it could happen that not all ports are added correctly to the port list for TCP pings.
If we init an GArray with elements of type int and then get elements from this array with g_array_index (array, uint16_t, index) we get 0 every second port. This is fixed by always using uint16_t when initing the array and when filling it.

Why:

Bugs have to be fixed.

How:

Printed out the array of ports after it got filled. Before fix every second port was 0, after fix all ports are filled as expected.

Checklist:

The ports which are used for TCP pings are stored
in a GArray. TCP ports are of size uint16_t.
Now the array elements are all of size uint16_t.
When ports are added to the array they are first
cast to the appropriate type. The port lists
was already validated, so there are no values which
are bigger than uint16_t in it.
@ArnoStiefvater ArnoStiefvater marked this pull request as ready for review August 27, 2020 07:58
@jjnicola jjnicola merged commit 0305717 into greenbone:gvm-libs-20.08 Aug 27, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants