Skip to content

Commit 5f33a09

Browse files
can: isotp: convert struct tpcon::{idx,len} to unsigned int
In isotp_rcv_ff() 32 bit of data received over the network is assigned to struct tpcon::len. Later in that function the length is checked for the maximal supported length against MAX_MSG_LENGTH. As struct tpcon::len is an "int" this check does not work, if the provided length overflows the "int". Later on struct tpcon::idx is compared against struct tpcon::len. To fix this problem this patch converts both struct tpcon::{idx,len} to unsigned int. Fixes: e057dd3 ("can: add ISO 15765-2:2016 transport protocol") Link: https://lore.kernel.org/all/20220105132429.1170627-1-mkl@pengutronix.de Cc: stable@vger.kernel.org Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 4a8737f commit 5f33a09

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/can/isotp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ enum {
119119
};
120120

121121
struct tpcon {
122-
int idx;
123-
int len;
122+
unsigned int idx;
123+
unsigned int len;
124124
u32 state;
125125
u8 bs;
126126
u8 sn;

0 commit comments

Comments
 (0)