Commit 1f2a7a07 authored by Frediano Ziglio's avatar Frediano Ziglio
Browse files

channel-main: Make more clear that host_data and cert_subject_data are C strings

After commit ab42be2b

Copy SpiceMigrationDstInfo into spice_migrate") host_data and
cert_subject_data fields in spice_migrate structure are proper
terminated C strings so:
- check pointer instead of related field;
- you don't need to terminate again.
Signed-off-by: Frediano Ziglio's avatarFrediano Ziglio <>
Acked-by: Uri Lublin's avatarUri Lublin <>
parent ab42be2b
......@@ -2412,18 +2412,14 @@ static gboolean migrate_connect(spice_migrate *mig)
sport = info->sport;
host = (char*)info->host_data;
if (info->cert_subject_size == 0 ||
if (info->cert_subject_data == NULL ||
strlen((const char*)info->cert_subject_data) == 0) {
/* only verify hostname if no cert subject */
g_object_set(mig->session, "verify", SPICE_SESSION_VERIFY_HOSTNAME, NULL);
} else {
gchar *subject = g_alloca(info->cert_subject_size + 1);
strncpy(subject, (const char*)info->cert_subject_data, info->cert_subject_size);
subject[info->cert_subject_size] = '\0';
// session data are already copied
"cert-subject", subject,
"cert-subject", info->cert_subject_data,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment