]> git.proxmox.com Git - mirror_qemu.git/blobdiff - ui/vnc-auth-sasl.c
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu
[mirror_qemu.git] / ui / vnc-auth-sasl.c
index 9a0ad30a9448ca15a3f6136175f67efaebdd71dd..f3ad75d52bb5e12bef8e9472027fb96eee652c8d 100644 (file)
@@ -432,9 +432,7 @@ static int protocol_client_auth_sasl_start_len(VncState *vs, uint8_t *data, size
 
 static int protocol_client_auth_sasl_mechname(VncState *vs, uint8_t *data, size_t len)
 {
-    char *mechname = g_malloc(len + 1);
-    strncpy(mechname, (char*)data, len);
-    mechname[len] = '\0';
+    char *mechname = g_strndup((const char *) data, len);
     VNC_DEBUG("Got client mechname '%s' check against '%s'\n",
               mechname, vs->sasl.mechlist);