cms: Do not try to check binary format on stdin
authorTomas Mraz <tomas@openssl.org>
Wed, 4 Aug 2021 12:51:49 +0000 (14:51 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 5 Aug 2021 14:49:58 +0000 (16:49 +0200)
Fixes #16195

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/16216)

apps/cms.c

index 58ce54e4543cfbbbcf928b9db3abf8ebed5376c0..714cf3e4ff57bd8de5d34c52904b94296cf2459b 100644 (file)
@@ -278,6 +278,8 @@ static void warn_binary(const char *file)
     unsigned char linebuf[1024], *cur, *end;
     int len;
 
+    if (file == NULL)
+        return; /* cannot give a warning for stdin input */
     if ((bio = bio_open_default(file, 'r', FORMAT_BINARY)) == NULL)
         return; /* cannot give a proper warning since there is an error */
     while ((len = BIO_read(bio, linebuf, sizeof(linebuf))) > 0) {