summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_mbstr.c
diff options
context:
space:
mode:
authorbeck <>2014-04-26 18:56:38 +0000
committerbeck <>2014-04-26 18:56:38 +0000
commit47bb6e76785f0b1c4d19d8d0a02f3eb3813f96e2 (patch)
treedff54039de6c4454b05953e2ce78edfc5693e6b5 /src/lib/libcrypto/asn1/a_mbstr.c
parent8f710803a9e330d7e3f2e62116ae5b3fc02bd6cf (diff)
downloadopenbsd-47bb6e76785f0b1c4d19d8d0a02f3eb3813f96e2.tar.gz
openbsd-47bb6e76785f0b1c4d19d8d0a02f3eb3813f96e2.tar.bz2
openbsd-47bb6e76785f0b1c4d19d8d0a02f3eb3813f96e2.zip
Replace all use of ERR_add_error_data with ERR_asprintf_error_data.
This avoids a lot of ugly gymnastics to do snprintfs before sending the bag of strings to ERR, and eliminates at least one place in dso_dlfctn.c where it was being called with the incorrect number of arguments and using random things off the stack as addresses of strings. ok krw@, jsing@
Diffstat (limited to 'src/lib/libcrypto/asn1/a_mbstr.c')
-rw-r--r--src/lib/libcrypto/asn1/a_mbstr.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c
index b59d84910f..9945ede2ac 100644
--- a/src/lib/libcrypto/asn1/a_mbstr.c
+++ b/src/lib/libcrypto/asn1/a_mbstr.c
@@ -98,7 +98,6 @@ ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
98 ASN1_STRING *dest; 98 ASN1_STRING *dest;
99 unsigned char *p; 99 unsigned char *p;
100 int nchar; 100 int nchar;
101 char strbuf[32];
102 int (*cpyfunc)(unsigned long, void *) = NULL; 101 int (*cpyfunc)(unsigned long, void *) = NULL;
103 102
104 if (len == -1) 103 if (len == -1)
@@ -148,15 +147,13 @@ ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
148 147
149 if ((minsize > 0) && (nchar < minsize)) { 148 if ((minsize > 0) && (nchar < minsize)) {
150 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT); 149 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT);
151 snprintf(strbuf, sizeof strbuf, "%ld", minsize); 150 ERR_asprintf_error_data("minsize=%ld", minsize);
152 ERR_add_error_data(2, "minsize=", strbuf);
153 return -1; 151 return -1;
154 } 152 }
155 153
156 if ((maxsize > 0) && (nchar > maxsize)) { 154 if ((maxsize > 0) && (nchar > maxsize)) {
157 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG); 155 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG);
158 snprintf(strbuf, sizeof strbuf, "%ld", maxsize); 156 ERR_asprintf_error_data("maxsize=%ld", maxsize);
159 ERR_add_error_data(2, "maxsize=", strbuf);
160 return -1; 157 return -1;
161 } 158 }
162 159