diff options
author | beck <> | 2017-01-29 17:49:23 +0000 |
---|---|---|
committer | beck <> | 2017-01-29 17:49:23 +0000 |
commit | 957b11334a7afb14537322f0e4795b2e368b3f59 (patch) | |
tree | 1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/asn1/f_enum.c | |
parent | df96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff) | |
download | openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2 openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip |
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/asn1/f_enum.c')
-rw-r--r-- | src/lib/libcrypto/asn1/f_enum.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/f_enum.c b/src/lib/libcrypto/asn1/f_enum.c index 7f064edb04..64feb97dc4 100644 --- a/src/lib/libcrypto/asn1/f_enum.c +++ b/src/lib/libcrypto/asn1/f_enum.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: f_enum.c,v 1.14 2014/07/11 08:44:47 jsing Exp $ */ | 1 | /* $OpenBSD: f_enum.c,v 1.15 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -150,16 +150,14 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
150 | k = 0; | 150 | k = 0; |
151 | i -= again; | 151 | i -= again; |
152 | if (i % 2 != 0) { | 152 | if (i % 2 != 0) { |
153 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, | 153 | ASN1error(ASN1_R_ODD_NUMBER_OF_CHARS); |
154 | ASN1_R_ODD_NUMBER_OF_CHARS); | ||
155 | goto err; | 154 | goto err; |
156 | } | 155 | } |
157 | i /= 2; | 156 | i /= 2; |
158 | if (num + i > slen) { | 157 | if (num + i > slen) { |
159 | sp = realloc(s, num + i); | 158 | sp = realloc(s, num + i); |
160 | if (sp == NULL) { | 159 | if (sp == NULL) { |
161 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, | 160 | ASN1error(ERR_R_MALLOC_FAILURE); |
162 | ERR_R_MALLOC_FAILURE); | ||
163 | goto err; | 161 | goto err; |
164 | } | 162 | } |
165 | s = sp; | 163 | s = sp; |
@@ -175,8 +173,7 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
175 | else if ((m >= 'A') && (m <= 'F')) | 173 | else if ((m >= 'A') && (m <= 'F')) |
176 | m = m - 'A' + 10; | 174 | m = m - 'A' + 10; |
177 | else { | 175 | else { |
178 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, | 176 | ASN1error(ASN1_R_NON_HEX_CHARACTERS); |
179 | ASN1_R_NON_HEX_CHARACTERS); | ||
180 | goto err; | 177 | goto err; |
181 | } | 178 | } |
182 | s[num + j] <<= 4; | 179 | s[num + j] <<= 4; |
@@ -194,7 +191,7 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
194 | return (1); | 191 | return (1); |
195 | 192 | ||
196 | err_sl: | 193 | err_sl: |
197 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE); | 194 | ASN1error(ASN1_R_SHORT_LINE); |
198 | err: | 195 | err: |
199 | free(s); | 196 | free(s); |
200 | return (ret); | 197 | return (ret); |