[linux-dvb] [PATCH] NXT200X - Change lengths from u8 to int

Johannes Stezenbach js at linuxtv.org
Fri Nov 4 07:14:15 CET 2005


On Fri, Nov 04, 2005 at 12:49:51AM -0500, Michael Krufky wrote:
> Kirk Lapray wrote:
> 
> >This patch changes all lengths from u8 to int types.  It seems to make 
> >more sense that we use int instead of u8.  I am not sure why I didn't 
> >do that in the first place.
> >
> >*nxt200x.c:
> >- Change length types from u8 to int
> >
> >Signed-off-by: Kirk Lapray <kirk.lapray at gmail.com 
> ><mailto:kirk.lapray at gmail.com>>
> 
> 
> Applied, Thanks.

This bit is problematic:

-static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, u8 len)
+static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, int len)
 {
        u8 buf2 [len+1];


akpm already complained about the variable length array on the stack,
now with int instead of u8 it could easily overflow the stack.
How do you guaranteee that this is not going to happen?

Johannes



More information about the linux-dvb mailing list