[threads] Allow resetting the name of a threadpool thread (#4350)
[mono.git] / mono / mini / debugger-agent.c
index f64481d661fc599ae756a683e236674d61ba2d7d..541b26e160a60bcffcdd4db5f8beb030f26a40fb 100644 (file)
@@ -830,9 +830,10 @@ parse_address (char *address, char **host, int *port)
        if (pos == NULL || pos == address)
                return 1;
 
-       *host = (char *)g_malloc (pos - address + 1);
-       strncpy (*host, address, pos - address);
-       (*host) [pos - address] = '\0';
+       size_t len = pos - address;
+       *host = (char *)g_malloc (len + 1);
+       memcpy (*host, address, len);
+       (*host) [len] = '\0';
 
        *port = atoi (pos + 1);
 
@@ -10136,7 +10137,7 @@ debugger_thread (void *arg)
        debugger_thread_id = mono_native_thread_id_get ();
 
        MonoThread *thread = mono_thread_attach (mono_get_root_domain ());
-       mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "Debugger agent"), TRUE, &error);
+       mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "Debugger agent"), TRUE, FALSE, &error);
        mono_error_assert_ok (&error);
 
        thread->internal_thread->state |= ThreadState_Background;