Skip to content

Commit f97a34b

Browse files
botovqmillert
authored andcommitted
Use accessor for getting an ASN1_STRING's length
OpensSSL 4 has plans to make ASN1_STRING opaque [1]. hostcheck.c's code mostly treats it as opaque, but accesses two lengths. This is API added in OpenSSL 0.9.0, so I'm not sure we need a configure check. WolfSSL only recently const corrected ASN1_STRING_length(), so maybe there will be a need to cast away const. [1]: openssl/openssl#29117
1 parent 8eeca49 commit f97a34b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/iolog/hostcheck.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ matches_subject_alternative_name(const char *hostname, const char *ipaddr,
208208
#endif
209209

210210
/* IPV4 address */
211-
if (current_name->d.iPAddress->length == 4) {
211+
if (ASN1_STRING_length(current_name->d.iPAddress) == 4) {
212212
if (inet_ntop(AF_INET, san_ip, san_ip_str, INET_ADDRSTRLEN) == NULL) {
213213
ret = MalformedCertificate;
214214
break;
215215
}
216216
#if defined(HAVE_STRUCT_IN6_ADDR)
217217
/* IPV6 address */
218-
} else if (current_name->d.iPAddress->length == 16) {
218+
} else if (ASN1_STRING_length(current_name->d.iPAddress) == 16) {
219219
if (inet_ntop(AF_INET6, san_ip, san_ip_str, INET6_ADDRSTRLEN) == NULL) {
220220
ret = MalformedCertificate;
221221
break;

0 commit comments

Comments
 (0)