mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-10 18:53:18 +00:00
stream-channel: Fix compiler warning
This removes:
In function ‘stream_channel_get_supported_codecs’,
inlined from ‘on_connect’ at ../server/stream-channel.cpp:364:60:
../server/stream-channel.cpp:326:31: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
326 | out_codecs[num++] = codec;
| ^
../server/stream-channel.cpp: In member function ‘on_connect’:
/usr/include/spice-1/spice/stream-device.h:209:13: note: destination object ‘codecs’ of size 0
209 | uint8_t codecs[0];
| ^
Reported by by Tomasz Kłoczko in
https://gitlab.freedesktop.org/spice/spice/-/issues/44
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
This commit is contained in:
parent
0b86b6808a
commit
c5412b071a
@ -351,6 +351,9 @@ void StreamChannel::on_connect(RedClient *red_client, RedStream *stream,
|
||||
StreamMsgStartStop base;
|
||||
uint8_t codecs_buffer[MAX_SUPPORTED_CODECS];
|
||||
} start_msg;
|
||||
static_assert(offsetof(StreamMsgStartStop, codecs) ==
|
||||
offsetof(decltype(start_msg), codecs_buffer),
|
||||
"Wrong assumption");
|
||||
StreamMsgStartStop *const start = &start_msg.base;
|
||||
|
||||
spice_return_if_fail(stream != nullptr);
|
||||
@ -361,7 +364,7 @@ void StreamChannel::on_connect(RedClient *red_client, RedStream *stream,
|
||||
}
|
||||
|
||||
// request new stream
|
||||
start->num_codecs = stream_channel_get_supported_codecs(this, start->codecs);
|
||||
start->num_codecs = stream_channel_get_supported_codecs(this, start_msg.codecs_buffer);
|
||||
// send in any case, even if list is not changed
|
||||
// notify device about changes
|
||||
request_new_stream(start);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user