summaryrefslogtreecommitdiffstats
path: root/server/reds.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-20 20:29:15 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-23 13:10:54 +0100
commitd4ba4ee690aeb72b86c5342c77a54b5a1a185975 (patch)
tree746a0cb2d63eb7f003ea90a1963bf0aee3fd1bd3 /server/reds.c
parenta7d3f1de82e90da869775e8306e0dba7d95bd597 (diff)
downloadspice-d4ba4ee690aeb72b86c5342c77a54b5a1a185975.tar.gz
spice-d4ba4ee690aeb72b86c5342c77a54b5a1a185975.tar.xz
spice-d4ba4ee690aeb72b86c5342c77a54b5a1a185975.zip
Use spice_strdup() to avoid crashing on NULL
qemu can call spice_server_set_name(s, NULL) when the name is not given. Let's not crash in this case
Diffstat (limited to 'server/reds.c')
-rw-r--r--server/reds.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/reds.c b/server/reds.c
index c54d30c5..b5d185e1 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2397,7 +2397,7 @@ static void reds_handle_auth_mechname(void *opaque)
}
free(sasl->mechlist);
- sasl->mechlist = strdup(sasl->mechname);
+ sasl->mechlist = spice_strdup(sasl->mechname);
red_printf("Validated mechname '%s'", sasl->mechname);
@@ -2532,7 +2532,7 @@ static void reds_start_auth_sasl(RedLinkInfo *link)
}
red_printf("Available mechanisms for client: '%s'", mechlist);
- sasl->mechlist = strdup(mechlist);
+ sasl->mechlist = spice_strdup(mechlist);
mechlistlen = strlen(mechlist);
if (!sync_write(link->stream, &mechlistlen, sizeof(uint32_t))
@@ -3829,7 +3829,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_sasl_appname(SpiceServer *s, const char
ASSERT(reds == s);
#if HAVE_SASL
free(sasl_appname);
- sasl_appname = strdup(appname);
+ sasl_appname = spice_strdup(appname);
return 0;
#else
return -1;
@@ -3839,7 +3839,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_sasl_appname(SpiceServer *s, const char
SPICE_GNUC_VISIBLE void spice_server_set_name(SpiceServer *s, const char *name)
{
free(spice_name);
- spice_name = strdup(name);
+ spice_name = spice_strdup(name);
}
SPICE_GNUC_VISIBLE void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16])
@@ -4075,9 +4075,9 @@ static int reds_set_migration_dest_info(const char* dest,
spice_migration = spice_new0(RedsMigSpice, 1);
spice_migration->port = port;
spice_migration->sport = secure_port;
- spice_migration->host = strdup(dest);
+ spice_migration->host = spice_strdup(dest);
if (cert_subject) {
- spice_migration->cert_subject = strdup(cert_subject);
+ spice_migration->cert_subject = spice_strdup(cert_subject);
}
reds->mig_spice = spice_migration;