mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Use size_t cast for pointer subtractions
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
@ -169,7 +169,7 @@ static int parse_attribute_value_string(const char *s,
|
||||
return MBEDTLS_ERR_X509_INVALID_NAME;
|
||||
}
|
||||
}
|
||||
*data_len = d - data;
|
||||
*data_len = (size_t) (d - data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -297,8 +297,8 @@ int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *nam
|
||||
|
||||
while (c <= end) {
|
||||
if (in_attr_type && *c == '=') {
|
||||
if ((attr_descr = x509_attr_descr_from_name(s, c - s)) == NULL) {
|
||||
if ((mbedtls_oid_from_numeric_string(&oid, s, c - s)) != 0) {
|
||||
if ((attr_descr = x509_attr_descr_from_name(s, (size_t) (c - s))) == NULL) {
|
||||
if ((mbedtls_oid_from_numeric_string(&oid, s, (size_t) (c - s))) != 0) {
|
||||
return MBEDTLS_ERR_X509_INVALID_NAME;
|
||||
} else {
|
||||
numericoid = 1;
|
||||
@ -322,7 +322,7 @@ int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *nam
|
||||
/* We know that c >= s (loop invariant) and c != s (in this
|
||||
* else branch), hence c - s - 1 >= 0. */
|
||||
parse_ret = parse_attribute_value_hex_der_encoded(
|
||||
s + 1, c - s - 1,
|
||||
s + 1, (size_t) (c - s) - 1,
|
||||
data, sizeof(data), &data_len, &tag);
|
||||
if (parse_ret != 0) {
|
||||
mbedtls_free(oid.p);
|
||||
|
Reference in New Issue
Block a user