Skip to content

Commit e759760

Browse files
marckleinebuddehartkopp
authored andcommitted
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: e057dd3fc20f ("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 Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
1 parent 6e2fd18 commit e759760

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/can/isotp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ enum {
143143
};
144144

145145
struct tpcon {
146-
int idx;
147-
int len;
146+
unsigned int idx;
147+
unsigned int len;
148148
u32 state;
149149
u8 bs;
150150
u8 sn;

0 commit comments

Comments
 (0)