Harden modulemd_module_add_... functions against null-pointer dereferences - #641
Open
ppisar wants to merge 3 commits into
Open
Harden modulemd_module_add_... functions against null-pointer dereferences#641ppisar wants to merge 3 commits into
ppisar wants to merge 3 commits into
Conversation
…ences When the function checks that a module name of the module and the translations are equal, g_str_equal() functions is called. That function does not handle NULL arguments. While we do not pass modules or translations with NULL names to this private function now, it's better to hardern the function against it. This patch adds more preconditions to modulemd_module_add_translation() in order to prevent passing NULL to g_str_equal(). Again, automated tests are impossible becase Glib test framework fatalizes the preconditions.
When the function checks that a module name of the module and the obsoletes are equal, g_str_equal() functions is called. That function does not handle NULL arguments. While we do not pass modules or obsoletes with NULL names to this private function now, it's better to harden the function against it. This patch adds more preconditions to modulemd_module_add_obsoletes() in order to prevent passing NULL to g_str_equal(). Again, automated tests are impossible becase Glib test framework fatalizes the preconditions.
Signed-off-by: Libmodulemd CI <github-actions@github.com>
|
sgallagher
approved these changes
Aug 10, 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.



modulemd_module_add_obsoletes() and modulemd_module_add_translation() do not expect modules, translation, or obsletes objects with NULL module name. While it is not a problem in current use of these function, we cannot guarantee it in the future and we should add preconditions against the NULL names.
Found by Fedora 45 static analysis in August 2026 https://svashisht.fedorapeople.org/openscanhub/mass-scans/f45-03-Aug-2026/libmodulemd-2.15.3-3.fc45/scan-results.html.