summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vnc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/vnc.c b/vnc.c
index f0ebebd5dc..01bcc8d2b2 100644
--- a/vnc.c
+++ b/vnc.c
@@ -2329,10 +2329,8 @@ int vnc_display_open(DisplayState *ds, const char *display)
end = strchr(options, ',');
if (start && (!end || (start < end))) {
int len = end ? end-(start+1) : strlen(start+1);
- char *path = qemu_malloc(len+1);
+ char *path = qemu_strndup(start + 1, len);
- pstrcpy(path, len, start + 1);
- path[len] = '\0';
VNC_DEBUG("Trying certificate path '%s'\n", path);
if (vnc_set_x509_credential_dir(vs, path) < 0) {
fprintf(stderr, "Failed to find x509 certificates/keys in %s\n", path);