Selaa lähdekoodia

Phonet: refuse to send bigger than MTU packets

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Rémi Denis-Courmont 16 vuotta sitten
vanhempi
commit
ebfe92ca65
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      net/phonet/af_phonet.c

+ 2 - 2
net/phonet/af_phonet.c

@@ -144,8 +144,8 @@ static int pn_send(struct sk_buff *skb, struct net_device *dev,
 	struct phonethdr *ph;
 	int err;
 
-	if (skb->len + 2 > 0xffff) {
-		/* Phonet length field would overflow */
+	if (skb->len + 2 > 0xffff /* Phonet length field limit */ ||
+	    skb->len + sizeof(struct phonethdr) > dev->mtu) {
 		err = -EMSGSIZE;
 		goto drop;
 	}