diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 7eb04e66a0..6077457ff4 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -451,6 +451,12 @@ virQEMUDriverConfigLoadVNCEntry(virQEMUDriverConfig *cfg, if (virConfGetValueBool(conf, "vnc_allow_host_audio", &cfg->vncAllowHostAudio) < 0) return -1; + if (cfg->vncPassword && + strlen(cfg->vncPassword) > 8) { + VIR_WARN("VNC password is %zu characters long, only 8 permitted, truncating", + strlen(cfg->vncPassword)); + cfg->vncPassword[8] = '\0'; + } return 0; } diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f9a195e991..46b40303f6 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4109,6 +4109,14 @@ qemuValidateDomainDeviceDefVNCGraphics(const virDomainGraphicsDef *graphics, return -1; } + if (graphics->data.vnc.auth.passwd && + strlen(graphics->data.vnc.auth.passwd) > 8) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("VNC password is %zu characters long, only 8 permitted"), + strlen(graphics->data.vnc.auth.passwd)); + return -1; + } + return 0; }