]> granicus.if.org Git - libevent/commitdiff
avoid sign mismatch warning in openssl_hostname_validation.c
authorPatrick Pelletier <code@funwithsoftware.org>
Thu, 28 Feb 2013 05:19:16 +0000 (21:19 -0800)
committerPatrick Pelletier <code@funwithsoftware.org>
Thu, 28 Feb 2013 05:22:03 +0000 (21:22 -0800)
sample/openssl_hostname_validation.c: In function 'matches_common_name':
sample/openssl_hostname_validation.c:80: warning: comparison between signed and unsigned integer expressions
sample/openssl_hostname_validation.c: In function 'matches_subject_alternative_name':
sample/openssl_hostname_validation.c:124: warning: comparison between signed and unsigned integer expressions

sample/openssl_hostname_validation.c

index 94f0c0eb8918644857d6ddfd02c819461440e040..6f40cea8343da47ee49913275c6fc672cc56772e 100644 (file)
@@ -77,7 +77,7 @@ static HostnameValidationResult matches_common_name(const char *hostname, const
         common_name_str = (char *) ASN1_STRING_data(common_name_asn1);
 
         // Make sure there isn't an embedded NUL character in the CN
-        if (ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) {
+        if ((size_t)ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) {
                 return MalformedCertificate;
         }
 
@@ -121,7 +121,7 @@ static HostnameValidationResult matches_subject_alternative_name(const char *hos
                         char *dns_name = (char *) ASN1_STRING_data(current_name->d.dNSName);
 
                         // Make sure there isn't an embedded NUL character in the DNS name
-                        if (ASN1_STRING_length(current_name->d.dNSName) != strlen(dns_name)) {
+                        if ((size_t)ASN1_STRING_length(current_name->d.dNSName) != strlen(dns_name)) {
                                 result = MalformedCertificate;
                                 break;
                         }