[openssl] OpenSSL_1_1_1-stable update
beldmit at gmail.com
beldmit at gmail.com
Thu Jan 14 10:24:29 UTC 2021
The branch OpenSSL_1_1_1-stable has been updated
via 2a9785c252df6836da90da33aaeed8edb506e556 (commit)
from cfd7225fbb9507b2e443a494459bdaab5236d29d (commit)
- Log -----------------------------------------------------------------
commit 2a9785c252df6836da90da33aaeed8edb506e556
Author: Dmitry Belyavskiy <beldmit at gmail.com>
Date: Wed Jan 13 08:51:39 2021 +0100
Skip BOM when reading the config file
Fixes #13840
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13857)
(cherry picked from commit 4369a882a565c42673b28c586a5c46a8bca98d17)
-----------------------------------------------------------------------
Summary of changes:
crypto/conf/conf_def.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index 3d710f12ae..c097ec1286 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -185,6 +185,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
BUF_MEM *buff = NULL;
char *s, *p, *end;
int again;
+ int first_call = 1;
long eline = 0;
char btmp[DECIMAL_SIZE(eline) + 1];
CONF_VALUE *v = NULL, *tv;
@@ -233,6 +234,19 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
BIO_gets(in, p, CONFBUFSIZE - 1);
p[CONFBUFSIZE - 1] = '\0';
ii = i = strlen(p);
+ if (first_call) {
+ /* Other BOMs imply unsupported multibyte encoding,
+ * so don't strip them and let the error raise */
+ const unsigned char utf8_bom[3] = {0xEF, 0xBB, 0xBF};
+
+ if (i >= 3 && memcmp(p, utf8_bom, 3) == 0) {
+ memmove(p, p + 3, i - 3);
+ p[i - 3] = 0;
+ i -= 3;
+ ii -= 3;
+ }
+ first_call = 0;
+ }
if (i == 0 && !again) {
/* the currently processed BIO is at EOF */
BIO *parent;
More information about the openssl-commits
mailing list