Make ASN1_OBJECT_create size_t-clean.

Change-Id: If7eb9daf65f6c9480a9bffb5f1e1ea3143c5faf7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/58146
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
This commit is contained in:
David Benjamin 2022-12-31 23:13:48 -05:00 committed by Boringssl LUCI CQ
parent 2cb7b337d0
commit 173b63942d
2 changed files with 9 additions and 5 deletions

View File

@ -261,16 +261,20 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a) {
}
}
ASN1_OBJECT *ASN1_OBJECT_create(int nid, const unsigned char *data, int len,
ASN1_OBJECT *ASN1_OBJECT_create(int nid, const unsigned char *data, size_t len,
const char *sn, const char *ln) {
ASN1_OBJECT o;
if (len > INT_MAX) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_LONG);
return NULL;
}
ASN1_OBJECT o;
o.sn = sn;
o.ln = ln;
o.data = data;
o.nid = nid;
o.length = len;
o.length = (int)len;
o.flags = ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
ASN1_OBJECT_FLAG_DYNAMIC_DATA;
return (OBJ_dup(&o));
return OBJ_dup(&o);
}

View File

@ -1432,7 +1432,7 @@ DEFINE_STACK_OF(ASN1_OBJECT)
// TODO(davidben): Should we just ignore all those parameters? NIDs and names
// are only relevant for |ASN1_OBJECT|s in the obj.h table.
OPENSSL_EXPORT ASN1_OBJECT *ASN1_OBJECT_create(int nid, const uint8_t *data,
int len, const char *sn,
size_t len, const char *sn,
const char *ln);
// ASN1_OBJECT_free releases memory associated with |a|. If |a| is a static