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/[email protected] Cc: [email protected] Acked-by: Oliver Hartkopp <[email protected]> Reported-by: [email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 4a8737f commit 5f33a09

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
@@ -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)