lkml.org 
[lkml]   [2013]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/6] staging: ozwpan: Increase farewell report size.
On Thu, Aug 01, 2013 at 06:45:01PM +0100, Rupesh Gujare wrote:
> Farewell report size can be bigger than one byte, increase array
> size to accomodate maximum 32 bytes of farewell report.
>

Gar... No. This is not right.

1) There is no check limiting the size to 32 and it could be up to
253 bytes.

2) Use defines instead of magic numbers.

3) The oz_farewell struct is supposed to be a variable length struct
but the variable part is put in the middle. It doesn't make any
sense to put the length of the variable size array after then end
of the array because we can never find it again! Put the
variable size array at the end. Make it a zero length array.
u8 len;
u8 report[0];

4) In oz_add_farewell() we do this:

f = kmalloc(sizeof(struct oz_farewell) + len - 1, GFP_ATOMIC);

The "- 1" refers to sizeof(f->report) but because it was a magic
number then it was missed when the sizeof(f->report) changed.

5) In [patch 6/6] we set the ->len member. But because it is at the
end of a variable length array with no limit check the remote
attacker can just rewrite it using the memcpy() on the next line.

regards,
dan carpenter


\
 
 \ /
  Last update: 2013-08-02 13:01    [W:0.415 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site