aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCollin Funk via Gnupg-devel <[email protected]>2025-05-24 06:52:46 +0000
committerWerner Koch <[email protected]>2025-05-24 11:31:54 +0000
commit57c1c96e7f5c2b94daba5ccc0070cf3ee52d66d9 (patch)
treec092de733940a3fb6d076954e7424716afc70d53
parentgpg: Do not allow compressed key packets on import. (diff)
downloadgnupg-STABLE-BRANCH-2-4.tar.gz
gnupg-STABLE-BRANCH-2-4.zip
common: Fix read buffer over-read in uncompress_ecc_q_in_canon_sexp.STABLE-BRANCH-2-4
* common/sexputil.c (uncompress_ecc_q_in_canon_sexp): Only call memcmp if the lengths are equal. -- GnuPG-bug-id: 7662 Signed-off-by: Collin Funk <[email protected]>
-rw-r--r--common/sexputil.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/sexputil.c b/common/sexputil.c
index c7471be85..2b5d96812 100644
--- a/common/sexputil.c
+++ b/common/sexputil.c
@@ -784,11 +784,11 @@ uncompress_ecc_q_in_canon_sexp (const unsigned char *keydata,
return err;
if (!tok)
return gpg_error (GPG_ERR_BAD_PUBKEY);
- else if (toklen == 10 || !memcmp ("public-key", tok, toklen))
+ else if (toklen == 10 && !memcmp ("public-key", tok, toklen))
;
- else if (toklen == 11 || !memcmp ("private-key", tok, toklen))
+ else if (toklen == 11 && !memcmp ("private-key", tok, toklen))
;
- else if (toklen == 20 || !memcmp ("shadowed-private-key", tok, toklen))
+ else if (toklen == 20 && !memcmp ("shadowed-private-key", tok, toklen))
;
else
return gpg_error (GPG_ERR_BAD_PUBKEY);