summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/f_int.c
diff options
context:
space:
mode:
authorschwarze <>2021-11-23 11:10:51 +0000
committerschwarze <>2021-11-23 11:10:51 +0000
commit3af9d78c8b9e9f755a890250766ee91b89d49302 (patch)
treea8b05357992a2de0b2bf41411229a29f2401d2b0 /src/lib/libcrypto/asn1/f_int.c
parent2bdbde31a4bf50cc95d94889220a599f78e08415 (diff)
downloadopenbsd-3af9d78c8b9e9f755a890250766ee91b89d49302.tar.gz
openbsd-3af9d78c8b9e9f755a890250766ee91b89d49302.tar.bz2
openbsd-3af9d78c8b9e9f755a890250766ee91b89d49302.zip
re-align these copies of the a2i_*(3) code with f_string.c rev. 1.19
to fix the same double-counting of the backslash and to make the parsing stricter in the same way; OK tb@
Diffstat (limited to 'src/lib/libcrypto/asn1/f_int.c')
-rw-r--r--src/lib/libcrypto/asn1/f_int.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c
index d03fafe87d..8ce9d20d5f 100644
--- a/src/lib/libcrypto/asn1/f_int.c
+++ b/src/lib/libcrypto/asn1/f_int.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: f_int.c,v 1.20 2018/05/13 13:48:08 jsing Exp $ */ 1/* $OpenBSD: f_int.c,v 1.21 2021/11/23 11:10:51 schwarze 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 *
@@ -126,19 +126,12 @@ a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
126 buf[--i] = '\0'; 126 buf[--i] = '\0';
127 if (i == 0) 127 if (i == 0)
128 goto err_sl; 128 goto err_sl;
129 again = (buf[i - 1] == '\\'); 129 if (buf[i - 1] == '\\') {
130 130 i--;
131 for (j = 0; j < i; j++) { 131 again = 1;
132 if (!(((buf[j] >= '0') && (buf[j] <= '9')) || 132 } else
133 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 133 again = 0;
134 ((buf[j] >= 'A') && (buf[j] <= 'F')))) {
135 i = j;
136 break;
137 }
138 }
139 buf[i] = '\0'; 134 buf[i] = '\0';
140 /* We have now cleared all the crap off the end of the
141 * line */
142 if (i < 2) 135 if (i < 2)
143 goto err_sl; 136 goto err_sl;
144 137
@@ -151,7 +144,6 @@ a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
151 } 144 }
152 } 145 }
153 k = 0; 146 k = 0;
154 i -= again;
155 if (i % 2 != 0) { 147 if (i % 2 != 0) {
156 ASN1error(ASN1_R_ODD_NUMBER_OF_CHARS); 148 ASN1error(ASN1_R_ODD_NUMBER_OF_CHARS);
157 goto err; 149 goto err;