diff options
| author | jsing <> | 2021-12-09 16:56:15 +0000 | 
|---|---|---|
| committer | jsing <> | 2021-12-09 16:56:15 +0000 | 
| commit | 6e8a5f666a6873d46f12bf3f99a69cfeac3cdc3f (patch) | |
| tree | 77d3ef05bb4474cdbe08115392a6bef895235f04 /src/lib/libc | |
| parent | 173d66f484127151729726c4f8a134f28ec9f368 (diff) | |
| download | openbsd-6e8a5f666a6873d46f12bf3f99a69cfeac3cdc3f.tar.gz openbsd-6e8a5f666a6873d46f12bf3f99a69cfeac3cdc3f.tar.bz2 openbsd-6e8a5f666a6873d46f12bf3f99a69cfeac3cdc3f.zip | |
Remove handling of a NULL BUF_MEM from asn1_collect()
asn1_collect() (and hence collect_data()) is never called without
a BUF_MEM - the only caller that passed NULL was removed in OpenSSL
commit e1cc0671ac5.
ok inoguchi@ tb@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 23 | 
1 files changed, 9 insertions, 14 deletions
| diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 331b147936..b1fb5886c4 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_dec.c,v 1.41 2021/12/03 17:27:34 jsing Exp $ */ | 1 | /* $OpenBSD: tasn_dec.c,v 1.42 2021/12/09 16:56:15 jsing Exp $ */ | 
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 
| 3 | * project 2000. | 3 | * project 2000. | 
| 4 | */ | 4 | */ | 
| @@ -1022,12 +1022,7 @@ asn1_collect(BUF_MEM *buf, const unsigned char **in, long len, char inf, | |||
| 1022 | 1022 | ||
| 1023 | p = *in; | 1023 | p = *in; | 
| 1024 | inf &= 1; | 1024 | inf &= 1; | 
| 1025 | /* If no buffer and not indefinite length constructed just pass over | 1025 | |
| 1026 | * the encoded data */ | ||
| 1027 | if (!buf && !inf) { | ||
| 1028 | *in += len; | ||
| 1029 | return 1; | ||
| 1030 | } | ||
| 1031 | while (len > 0) { | 1026 | while (len > 0) { | 
| 1032 | q = p; | 1027 | q = p; | 
| 1033 | /* Check for EOC */ | 1028 | /* Check for EOC */ | 
| @@ -1073,14 +1068,14 @@ static int | |||
| 1073 | collect_data(BUF_MEM *buf, const unsigned char **p, long plen) | 1068 | collect_data(BUF_MEM *buf, const unsigned char **p, long plen) | 
| 1074 | { | 1069 | { | 
| 1075 | int len; | 1070 | int len; | 
| 1076 | if (buf) { | 1071 | |
| 1077 | len = buf->length; | 1072 | len = buf->length; | 
| 1078 | if (!BUF_MEM_grow_clean(buf, len + plen)) { | 1073 | if (!BUF_MEM_grow_clean(buf, len + plen)) { | 
| 1079 | ASN1error(ERR_R_MALLOC_FAILURE); | 1074 | ASN1error(ERR_R_MALLOC_FAILURE); | 
| 1080 | return 0; | 1075 | return 0; | 
| 1081 | } | ||
| 1082 | memcpy(buf->data + len, *p, plen); | ||
| 1083 | } | 1076 | } | 
| 1077 | memcpy(buf->data + len, *p, plen); | ||
| 1078 | |||
| 1084 | *p += plen; | 1079 | *p += plen; | 
| 1085 | return 1; | 1080 | return 1; | 
| 1086 | } | 1081 | } | 
