Files
twx-linux/include/uapi/linux
Chris Packham f02d577c6f tipc: Avoid copying bytes beyond the supplied data
TLV_SET is called with a data pointer and a len parameter that tells us
how many bytes are pointed to by data. When invoking memcpy() we need
to careful to only copy len bytes.

Previously we would copy TLV_LENGTH(len) bytes which would copy an extra
4 bytes past the end of the data pointer which newer GCC versions
complain about.

 In file included from test.c:17:
 In function 'TLV_SET',
     inlined from 'test' at test.c:186:5:
 /usr/include/linux/tipc_config.h:317:3:
 warning: 'memcpy' forming offset [33, 36] is out of the bounds [0, 32]
 of object 'bearer_name' with type 'char[32]' [-Warray-bounds]
     memcpy(TLV_DATA(tlv_ptr), data, tlv_len);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.c: In function 'test':
 test.c::161:10: note:
 'bearer_name' declared here
     char bearer_name[TIPC_MAX_BEARER_NAME];
          ^~~~~~~~~~~

We still want to ensure any padding bytes at the end are initialised, do
this with a explicit memset() rather than copy bytes past the end of
data. Apply the same logic to TCM_SET.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-11 12:22:34 +02:00
..
…
…
…
…
…
…
…
2016-12-05 19:43:02 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-12-05 11:24:34 +01:00
…
…
…
2016-09-23 08:40:28 -04:00
…
2016-10-03 18:52:14 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-03-22 09:17:38 +01:00
…
…
…
…
…
2016-06-08 11:36:02 -07:00
…
…
…
…
2016-10-01 07:32:32 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2016-03-22 15:36:02 -07:00
…
…
…
2016-06-27 16:31:25 +01:00
2016-04-12 19:54:58 +01:00
2016-04-25 15:09:10 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2016-05-17 17:14:21 -06:00
…
…
…
…
…
…
…
…
…
…
…
…
…
2016-09-27 21:52:00 -04:00
2016-09-27 21:52:00 -04:00
…
…
…
2018-04-20 08:21:04 +02:00
…
…
2016-05-08 23:46:14 -04:00
2016-04-26 12:00:48 -04:00
2018-04-24 09:34:16 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
2016-04-04 22:11:20 -04:00
…
…
…
…
…
…
…
…
…
2016-09-21 00:23:00 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2016-05-20 17:58:30 -07:00
…
…
2016-08-02 16:53:54 +03:00
2016-04-30 09:26:55 -07:00
…
…
…
…
…