weston/libweston/backend-rdp
Marius Vlad 9455ad7c7c backend-rdp/rdpclip: Avoid printing negative index
As clipboard_find_supported_format_by_mime_type() can return -1 if it
can't find out an index avoid trying to print outside of the array.

Fixes the following warnings triggered when enabling FORTIFY_SOURCE
combined with optimizations (-O)

../libweston/backend-rdp/rdpclip.c:1114:17: error: array subscript -1 is below array bounds of ‘uint32_t[5]’ {aka ‘unsigned int[5]’} [-Werror=array-bounds]
 1114 |                 weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d formatId:%d is not supported by client\n",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1115 |                            __func__, source, clipboard_data_source_state_to_string(source),
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1116 |                            mime_type, index, source->client_format_id_table[index]);
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../libweston/backend-rdp/rdpclip.c:131:18: note: while referencing ‘client_format_id_table’
  131 |         uint32_t client_format_id_table[RDP_NUM_CLIPBOARD_FORMATS];

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 11:32:19 +00:00
..
meson.build rdp: Update to newer FreeRDP release 2022-06-09 13:17:03 +00:00
rdp.c rdp: Move peer list from output to backend 2022-07-26 17:34:20 +00:00
rdp.h rdp: Move peer list from output to backend 2022-07-26 17:34:20 +00:00
rdpclip.c backend-rdp/rdpclip: Avoid printing negative index 2022-09-23 11:32:19 +00:00
rdputil.c rdp: Make thread checks unconfigurable 2022-05-24 07:29:45 -05:00