diff --git a/g10/plaintext.c b/g10/plaintext.c index 5c21dd7f6..d7f9df1f8 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -476,6 +476,13 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx, state = 1; else if (c == '\n') state = 2; + else if (c == '\f') + { + /* Form feed indicates line truncation - this is a security issue */ + log_error ("cleartext signature contains truncated line (form feed detected)\n"); + err = gpg_error (GPG_ERR_BAD_SIGNATURE); + goto leave; + } else gcry_md_putc (mfx->md, c); } @@ -486,6 +493,12 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx, else { gcry_md_putc (mfx->md, '\r'); + if (c == '\f') + { + log_error ("cleartext signature contains truncated line (form feed detected)\n"); + err = gpg_error (GPG_ERR_BAD_SIGNATURE); + goto leave; + } if (c == '\r') state = 1; else