Replace misleading error message when loading PEM
authorTomas Mraz <tmraz@fedoraproject.org>
Mon, 11 May 2020 15:15:40 +0000 (17:15 +0200)
committerTomas Mraz <tmraz@fedoraproject.org>
Tue, 12 May 2020 17:25:14 +0000 (19:25 +0200)
The error message "short header" when the end line
of PEM data cannot be identified is misleading.
Replace it with already existing "bad end line" error.

Fixes #8815

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/11793)

(cherry picked from commit f523ca66612e6712f287aa4b4ed722a5f2d4d960)

crypto/pem/pem_lib.c

index 0d79f4aea0a326971dc28c6f8cc7d6bb1cd634ed..093ba09aeb8c133c75743e58b9d499c55ea177b7 100644 (file)
@@ -809,7 +809,7 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
         flags_mask = ~0u;
         len = BIO_gets(bp, linebuf, LINESIZE);
         if (len <= 0) {
-            PEMerr(PEM_F_GET_HEADER_AND_DATA, PEM_R_SHORT_HEADER);
+            PEMerr(PEM_F_GET_HEADER_AND_DATA, PEM_R_BAD_END_LINE);
             goto err;
         }