diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2023-09-25 13:08:27 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-10-03 10:29:39 +0200 |
| commit | 9e58d7a7561ace2e4ed62049f9d0ff488e1bb7f1 (patch) | |
| tree | d2495c0f611f12375f0ae148c16a9c9f117f23cb /ui/vnc.c | |
| parent | 0c1a5299ab1d04ade6e6ff0fa2bc98e33cecaa80 (diff) | |
| download | focaccia-qemu-9e58d7a7561ace2e4ed62049f9d0ff488e1bb7f1.tar.gz focaccia-qemu-9e58d7a7561ace2e4ed62049f9d0ff488e1bb7f1.zip | |
ui/vnc: Require audiodev= to enable audio
If there is no audiodev do not send the audio ack in response to VNC_ENCODING_AUDIO, so that clients aren't told audio exists, and immediately drop the client if they try to send any audio control messages when audio is not advertised. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'ui/vnc.c')
| -rw-r--r-- | ui/vnc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/vnc.c b/ui/vnc.c index c302bb07a5..acb56461b2 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2195,7 +2195,10 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) send_ext_key_event_ack(vs); break; case VNC_ENCODING_AUDIO: - send_ext_audio_ack(vs); + if (vs->vd->audio_state) { + vs->features |= VNC_FEATURE_AUDIO_MASK; + send_ext_audio_ack(vs); + } break; case VNC_ENCODING_WMVi: vs->features |= VNC_FEATURE_WMVI_MASK; @@ -2502,6 +2505,12 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) read_u32(data, 4), read_u32(data, 8)); break; case VNC_MSG_CLIENT_QEMU_AUDIO: + if (!vnc_has_feature(vs, VNC_FEATURE_AUDIO)) { + error_report("Audio message %d with audio disabled", read_u8(data, 2)); + vnc_client_error(vs); + break; + } + if (len == 2) return 4; |