Fix memory safety and type mismatch bugs (#63, #65, #66)#67
Open
dcpagotto wants to merge 1 commit intonasa-jpl:integrationfrom
Open
Fix memory safety and type mismatch bugs (#63, #65, #66)#67dcpagotto wants to merge 1 commit intonasa-jpl:integrationfrom
dcpagotto wants to merge 1 commit intonasa-jpl:integrationfrom
Conversation
…asa-jpl#66) - libams.c: dereference content pointer before calling MRELEASE (nasa-jpl#66) MRELEASE(content) was freeing the char** stack pointer instead of the actual buffer at *content, causing either a crash or memory leak. Other MRELEASE calls in the same function already use *content correctly. - dtkaadmin.c: remove unused sprintf and undersized stack buffer (nasa-jpl#65) The char test[5] buffer and sprintf call in manageLeadTime were dead code (result never used). sprintf with %u on a 5-byte buffer can overflow for values > 9999, which is valid since the only lower bound check is >= 20. - ipnfw.c: use sm_list_insert_last instead of sdr_list_insert_last (nasa-jpl#63) viaPassageways is created with sm_list_create (shared memory list) but was being populated with sdr_list_insert_last (SDR list function). Changed to sm_list_insert_last with ionwm partition, matching how the list is created and destroyed in the rest of the codebase.
This was referenced Jan 31, 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.
Fixes for three open bugs, all verified against the source. Minimal changes, one fix per file.
ams/library/libams.c— fix MRELEASE dereference (#66)constructMessagereceivescontentaschar **. At line 1118,MRELEASE(content)frees the stack pointer itself instead of the buffer it points to. Every other MRELEASE call in the same function correctly uses*content.tc/dtka/dtkaadmin.c— remove dead code with buffer overflow risk (#65)manageLeadTimedeclareschar test[5]and callssprintf(test, "%u", ...)but the result is never read. The buffer is too small for the full range ofunsigned int(up to 10 digits), and the only input validation is>= 20, so any value above 9999 would overflow. Removed both the buffer and the sprintf since they serve no purpose.bpv7/ipn/ipnfw.c— fix SDR/SM list type mismatch (#63)initializeHIRRcreatesviaPassagewayswithsm_list_create(ionwm)(shared memory list), but then tries to populate it usingsdr_list_insert_last(SDR persistent store function). These are completely different list implementations. Changed tosm_list_insert_last(ionwm, ...)to match the list type. This is consistent with how the list is destroyed inlibcgr.cusingsm_list_destroy.All three are single-line changes. No functional additions, just correcting existing behavior to match what the code clearly intended.