summaryrefslogtreecommitdiffstats
path: root/common/ssl_verify.c
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-10-23 11:34:11 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2015-11-27 17:50:02 +0100
commit9057e0aef335387458c5374c0e1b7a6c14bf5cef (patch)
tree6d01b2447d14484ba549da7341bb2d05ae10958b /common/ssl_verify.c
parentf8db887eb0f06abbbf0f5a4fff8f93be62e3433d (diff)
downloadspice-common-9057e0aef335387458c5374c0e1b7a6c14bf5cef.tar.gz
spice-common-9057e0aef335387458c5374c0e1b7a6c14bf5cef.tar.xz
spice-common-9057e0aef335387458c5374c0e1b7a6c14bf5cef.zip
ssl-verify: Handle NULL return from g_inet_address_new_from_string()
It will return NULL if the string we pass it cannot be parsed.
Diffstat (limited to 'common/ssl_verify.c')
-rw-r--r--common/ssl_verify.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/ssl_verify.c b/common/ssl_verify.c
index 867c54f..817cf7b 100644
--- a/common/ssl_verify.c
+++ b/common/ssl_verify.c
@@ -200,8 +200,12 @@ static int verify_hostname(X509* cert, const char *hostname)
found_dns_name = 1;
ip = g_inet_address_new_from_string(hostname);
- ip_len = g_inet_address_get_native_size(ip);
- ip_binary = g_inet_address_to_bytes(ip);
+ if (ip != NULL) {
+ ip_len = g_inet_address_get_native_size(ip);
+ ip_binary = g_inet_address_to_bytes(ip);
+ } else {
+ spice_warning("Could not parse hostname: %s", hostname);
+ }
alt_ip_len = ASN1_STRING_length(name->d.iPAddress);