diff options
author | Brent Cook <busterb@gmail.com> | 2022-07-10 23:30:58 -0500 |
---|---|---|
committer | Brent Cook <busterb@gmail.com> | 2022-07-10 23:30:58 -0500 |
commit | 1e562926d80ae8006296eb7926de6cbebc32d3ee (patch) | |
tree | 3e14e07caa5f788b3cf65f33bd1a2caa5f5e7b46 | |
parent | 5fe512b45f490af747f8eacc73d25dd41f761424 (diff) | |
download | portable-1e562926d80ae8006296eb7926de6cbebc32d3ee.tar.gz portable-1e562926d80ae8006296eb7926de6cbebc32d3ee.tar.bz2 portable-1e562926d80ae8006296eb7926de6cbebc32d3ee.zip |
add local patch for https://github.com/libressl-portable/portable/issues/760
-rw-r--r-- | patches/uninit_asn1_string_to_utf8.diff | 45 | ||||
-rwxr-xr-x | update.sh | 4 |
2 files changed, 49 insertions, 0 deletions
diff --git a/patches/uninit_asn1_string_to_utf8.diff b/patches/uninit_asn1_string_to_utf8.diff new file mode 100644 index 0000000..b0f31d4 --- /dev/null +++ b/patches/uninit_asn1_string_to_utf8.diff | |||
@@ -0,0 +1,45 @@ | |||
1 | commit 54dbcf45e7206fb845f0ca733a8473fe3f0926ac | ||
2 | Author: tb <> | ||
3 | Date: Mon May 16 20:41:24 2022 +0000 | ||
4 | |||
5 | Avoid use of uninitialized in ASN1_STRING_to_UTF8() | ||
6 | |||
7 | A long standing failure to initialize a struct on the stack fully was | ||
8 | exposed by a recent refactoring. Fortunately, the uninitialized 'flag' | ||
9 | member is only used to decide whether or not to call freezero(NULL, 0), | ||
10 | so it is completely harmless. This is a first trivial fix, a better | ||
11 | version will be landed separately with regress. | ||
12 | |||
13 | Reported by Steffen Jaeckel, GH #760 | ||
14 | |||
15 | ok beck | ||
16 | |||
17 | diff --git a/src/lib/libcrypto/asn1/a_string.c b/src/lib/libcrypto/asn1/a_string.c | ||
18 | index 90e363e9c7..9086d3bec8 100644 | ||
19 | --- a/src/lib/libcrypto/asn1/a_string.c | ||
20 | +++ b/src/lib/libcrypto/asn1/a_string.c | ||
21 | @@ -1,4 +1,4 @@ | ||
22 | -/* $OpenBSD: a_string.c,v 1.7 2022/03/17 17:17:58 jsing Exp $ */ | ||
23 | +/* $OpenBSD: a_string.c,v 1.8 2022/05/16 20:41:24 tb Exp $ */ | ||
24 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
25 | * All rights reserved. | ||
26 | * | ||
27 | @@ -276,7 +276,8 @@ ASN1_STRING_print(BIO *bp, const ASN1_STRING *astr) | ||
28 | int | ||
29 | ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in) | ||
30 | { | ||
31 | - ASN1_STRING stmp, *str = &stmp; | ||
32 | + ASN1_STRING stmp = { 0 }; | ||
33 | + ASN1_STRING *str = &stmp; | ||
34 | int mbflag, ret; | ||
35 | |||
36 | if (in == NULL) | ||
37 | @@ -287,8 +288,6 @@ ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in) | ||
38 | |||
39 | mbflag |= MBSTRING_FLAG; | ||
40 | |||
41 | - stmp.data = NULL; | ||
42 | - stmp.length = 0; | ||
43 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, | ||
44 | B_ASN1_UTF8STRING); | ||
45 | if (ret < 0) | ||
@@ -358,6 +358,10 @@ fi | |||
358 | for i in patches/*.patch; do | 358 | for i in patches/*.patch; do |
359 | $PATCH -p0 < $i | 359 | $PATCH -p0 < $i |
360 | done | 360 | done |
361 | # apply local patch for https://github.com/libressl-portable/portable/issues/760 | ||
362 | (cd crypto | ||
363 | $PATCH -p4 < ../patches/uninit_asn1_string_to_utf8.diff | ||
364 | ) | ||
361 | 365 | ||
362 | # copy manpages | 366 | # copy manpages |
363 | echo "copying manpages" | 367 | echo "copying manpages" |