]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PPP]: Fix osize too small errors when decoding mppe.
authorKonstantin Sharlaimov <konstantin.sharlaimov@gmail.com>
Mon, 24 Sep 2007 21:01:54 +0000 (23:01 +0200)
committerAdrian Bunk <bunk@stusta.de>
Mon, 24 Sep 2007 21:01:54 +0000 (23:01 +0200)
The mppe_decompress() function required a buffer that is 1 byte too
small when receiving a message of mru size. This fixes buffer
allocation to prevent this from occurring.

Signed-off-by: Konstantin Sharlaimov <konstantin.sharlaimov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
drivers/net/ppp_generic.c

index e37648c256fc94fd53985b26264827881e8f436a..802f249b87c81926a0a911f3dcea622caf795c9c 100644 (file)
@@ -1721,7 +1721,18 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
                goto err;
 
        if (proto == PPP_COMP) {
-               ns = dev_alloc_skb(ppp->mru + PPP_HDRLEN);
+               int obuff_size;
+
+               switch(ppp->rcomp->compress_proto) {
+               case CI_MPPE:
+                       obuff_size = ppp->mru + PPP_HDRLEN + 1;
+                       break;
+               default:
+                       obuff_size = ppp->mru + PPP_HDRLEN;
+                       break;
+               }
+
+               ns = dev_alloc_skb(obuff_size);
                if (ns == 0) {
                        printk(KERN_ERR "ppp_decompress_frame: no memory\n");
                        goto err;