Fix #148, Add table access protections - #150
Merged
Merged
Conversation
Scrub use of all table pointers and add access routines to get an entry from the table instead of dereferencing the array directly. This pattern allows easier verification that all access includes a NULL check. Also includes some refactoring to support this goal. Notably this includes changing the bitmask used to track if an appmon entry is active or inactive.
2 tasks
|
Tested on VM, with the table removed as stated in the issue this corrects. the following event were seen in response to the HS_CMD_ENABLE_APP_MON command: The system did not crash and the table was reverted to Disabled once the background task recognized that it could not be accessed. Approved |
ddstewar
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist (Please check before submitting)
Describe the contribution
Scrub use of all table pointers and add access routines to get an entry from the table instead of dereferencing the array directly. This pattern allows easier verification that all access includes a NULL check.
Also includes some refactoring to support this goal. Notably this includes changing the bitmask used to track if an appmon entry is active or inactive.
Fixes #148
Testing performed
Send command sequence that caused failure
Updated unit tests to cover those cases
Expected behavior changes
No segfaults when accessing table data
System(s) tested on
Linux
Additional context
Strongly recommend follow up to continue consolidating code. This PR touches on some things related to #5 but there is a lot more to do, a lot of code is still repetitive and could be refactored. Also, many functions rank high in cyclic complexity. This reduces it slightly by breaking up some functions (e.g. HS_MonitorApplications went from 128 to 90 by breaking it up) but 90 is still too high. There is much more that should be done to make smaller functions.
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.