diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-08-04 14:51:49 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-08-05 16:49:58 +0200 |
commit | f5c0f696193fa28741dfc08ab6b024cd07e38e5e (patch) | |
tree | 3263026e63441a156b26aa444a7a1bd26f485e1b /apps/cms.c | |
parent | req: Avoid segfault when -modulus is used (diff) | |
download | openssl-f5c0f696193fa28741dfc08ab6b024cd07e38e5e.tar.xz openssl-f5c0f696193fa28741dfc08ab6b024cd07e38e5e.zip |
cms: Do not try to check binary format on stdin
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)
Diffstat (limited to 'apps/cms.c')
-rw-r--r-- | apps/cms.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/cms.c b/apps/cms.c index 58ce54e454..714cf3e4ff 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -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) { |