Skip to content

Coverity fixes #3505

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

Merged
merged 6 commits into from
Apr 22, 2025
Merged

Coverity fixes #3505

merged 6 commits into from
Apr 22, 2025

Conversation

matt335672
Copy link
Member

Address these Coverity CIDs:-

  • 468122
  • 468126
  • 468127
  • 468130
  • 468134
  • 468139
  • 468148
  • 468156

Comments in the individual commits

@matt335672 matt335672 requested a review from Copilot April 17, 2025 14:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

common/scancode.c:369

  • The removal of the explicit index masking (i.e. index &= 0xff) may lead to unintended behavior when index exceeds 8 bits. Consider verifying if additional masking is necessary to preserve the intended behavior.
    // Removed: index &= 0xff;

Missing break statement in a switch intoduced by commit
54acca4

The results of this are benign, as the extra code which is run is
unlikely to do anything.
The datasize variable is an unsigned in, so comparing it to < 0 will
never be true. There is also a printf sequence for the variable which
should be %u rather than %d
@matt335672 matt335672 force-pushed the coverity_fixes branch 2 times, most recently from e124cf3 to dae9c79 Compare April 22, 2025 13:44
These Coverity warnings all relate to the user of g_setenv() where the
return result isn't checked.

An additional void function g_setenv_log() is provided which logs
failures to set environment variables, and returns no status. This is
used in all the places where g_setenv_is currently called.
g_bitmask_to_str() can return < 0 on error. This is not adequately
catered for.
Cater for xrdp_mm_get_value() returning NULL in a couple of places.

Also:-
- The function parse_chansrvport() now checks that passed-in value
  isn't NULL.
- Unnecessary uses of g_strncpy replaced with strlcpy()
Coverity is complaining about 32-bits being truncated to 16-bits.
Make the data conversion to unsigned short explicit.
@matt335672
Copy link
Member Author

Fixed a few typos in comments and retested.

@matt335672 matt335672 merged commit 44acc46 into neutrinolabs:devel Apr 22, 2025
14 checks passed
@matt335672 matt335672 deleted the coverity_fixes branch April 22, 2025 13:59
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