From 869cc5027c72b4d4cdd52eb4da66340166c3c211 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 11 Nov 2025 14:28:06 +0900 Subject: gpg: Fix armored input parsing. * g10/armor.c (radix64_read): Fix counting of characters in the trailer. -- Cherry-pick master commit of: 62b8bf2f390533d23e24d27552fecf562752d358 Signed-off-by: NIIBE Yutaka --- g10/armor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/g10/armor.c b/g10/armor.c index 24780e1dc..2222dee4e 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -1031,9 +1031,9 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, checkcrc++; break; } - else if (c == '-' - && afx->buffer_pos + 8 < afx->buffer_len - && !strncmp (afx->buffer, "-----END ", 8)) { + else if (afx->buffer_pos == 1 && c == '-' + && afx->buffer_len > 9 + && !strncmp (afx->buffer, "-----END ", 9)) { break; /* End in --dearmor mode or No CRC. */ } else { -- 2.39.5