diff options
author | David Benjamin <davidben@google.com> | 2023-03-25 01:42:18 -0400 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-19 14:11:01 +0000 |
commit | 32b51305debe43e38e7bf2c2b13c4ebf3b474e80 (patch) | |
tree | 455cd899b6e2b409210122fcab0fdc6dbff18830 /crypto/asn1 | |
parent | 6776d5cd8fcdf6c5e05bae2d655076dbeaa56103 (diff) | |
download | boringssl-32b51305debe43e38e7bf2c2b13c4ebf3b474e80.zip boringssl-32b51305debe43e38e7bf2c2b13c4ebf3b474e80.tar.gz boringssl-32b51305debe43e38e7bf2c2b13c4ebf3b474e80.tar.bz2 |
Widen ASN1_mbstring_copy and ASN1_mbstring_ncopy to ossl_ssize_t
Bug: 516
Change-Id: I3f374f05188bebe7aa4cbf45c81a6f945d3ce97c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/58549
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_mbstr.c | 17 | ||||
-rw-r--r-- | crypto/asn1/a_strnid.c | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c index 85a7b98..8fc82ab 100644 --- a/crypto/asn1/a_mbstr.c +++ b/crypto/asn1/a_mbstr.c @@ -73,18 +73,19 @@ // horrible: it has to be :-( The 'ncopy' form checks minimum and maximum // size limits too. -int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask) { - return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0); +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, + ossl_ssize_t len, int inform, unsigned long mask) { + return ASN1_mbstring_ncopy(out, in, len, inform, mask, /*minsize=*/0, + /*maxsize=*/0); } OPENSSL_DECLARE_ERROR_REASON(ASN1, INVALID_BMPSTRING) OPENSSL_DECLARE_ERROR_REASON(ASN1, INVALID_UNIVERSALSTRING) OPENSSL_DECLARE_ERROR_REASON(ASN1, INVALID_UTF8STRING) -int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask, long minsize, - long maxsize) { +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, + ossl_ssize_t len, int inform, unsigned long mask, + ossl_ssize_t minsize, ossl_ssize_t maxsize) { if (len == -1) { len = strlen((const char *)in); } @@ -164,14 +165,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, utf8_len += cbb_get_utf8_len(c); if (maxsize > 0 && nchar > (size_t)maxsize) { OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_LONG); - ERR_add_error_dataf("maxsize=%ld", maxsize); + ERR_add_error_dataf("maxsize=%zu", (size_t)maxsize); return -1; } } if (minsize > 0 && nchar < (size_t)minsize) { OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_SHORT); - ERR_add_error_dataf("minsize=%ld", minsize); + ERR_add_error_dataf("minsize=%zu", (size_t)minsize); return -1; } diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c index 3be266e..48c223d 100644 --- a/crypto/asn1/a_strnid.c +++ b/crypto/asn1/a_strnid.c @@ -87,7 +87,7 @@ static const ASN1_STRING_TABLE *asn1_string_table_get(int nid); // a corresponding OID. For example certificates and certificate requests. ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, - int len, int inform, int nid) { + ossl_ssize_t len, int inform, int nid) { ASN1_STRING *str = NULL; int ret; if (!out) { |