]> git.proxmox.com Git - mirror_qemu.git/commit
io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Fri, 19 Aug 2022 15:39:24 +0000 (16:39 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 22 Sep 2022 15:38:28 +0000 (16:38 +0100)
commit5e689840a10e01dc2ab87defc5347337db8103da
tree273bd76d85f080355a4ec30ed2c59b2b67bd9260
parentd34977d682e382fb2af83e6e6508e3b06d1a3cf2
io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1

The combined_key[... QIO_CHANNEL_WEBSOCK_GUID_LEN ...] array in
qio_channel_websock_handshake_send_res_ok() expands to a call
to strlen(QIO_CHANNEL_WEBSOCK_GUID), and the compiler doesn't
realize the string is const, so consider combined_key[] being
a variable-length array.

To remove the variable-length array, we provide it a hint to
the compiler by using sizeof() - 1 instead of strlen().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220819153931.3147384-5-peter.maydell@linaro.org
io/channel-websock.c