fix: correct duplicate NULL check in oqsx_get_hybrid_params() (GHSA-mqwg-cg22-g8r8)#767
Open
iiviel wants to merge 2 commits intoopen-quantum-safe:mainfrom
Open
fix: correct duplicate NULL check in oqsx_get_hybrid_params() (GHSA-mqwg-cg22-g8r8)#767iiviel wants to merge 2 commits intoopen-quantum-safe:mainfrom
iiviel wants to merge 2 commits intoopen-quantum-safe:mainfrom
Conversation
…free oqs_sig_dupctx() performs a shallow struct copy (*dstctx = *srcctx) but never deep-copies the heap-allocated `signature` field (added under the OPENSSL_VERSION_PREREQ(3,4) guard). Both srcctx and dstctx share the same pointer, and oqs_sig_freectx() frees it unconditionally, causing a double-free when both contexts are freed. Fix: 1. NULL out dstctx->signature and dstctx->siglen immediately after the shallow copy, alongside the existing NULLing of sig, md, mdctx. This prevents the error path (goto err → oqs_sig_freectx) from freeing srcctx's allocation. 2. Add an OPENSSL_memdup deep-copy of srcctx->signature before the return, with goto err on allocation failure. GHSA-2gh6-p878-65cq Signed-off-by: Eva Crystal <0xiviel@gmail.com>
…qwg-cg22-g8r8) Replace duplicate comp_privkey != NULL check with correct privkey != NULL check at oqs_kmgmt.c:412. The copy-paste error allowed the code to proceed with a dangling comp_privkey pointer when privkey had been freed, causing a use-after-free (CWE-416) readable via EVP_PKEY_get_params(). Signed-off-by: Eva Crystal <0xiviel@gmail.com>
4009d01 to
222e765
Compare
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 the copy-paste NULL check bug at oqs_kmgmt.c:412. Replaces duplicate key->comp_privkey != NULL check with correct key->privkey != NULL check. Submitted per request in GHSA-mqwg-cg22-g8r8.