Re: [PATCH v2 1/2] staging: gs_fpgaboot: add buffer overflow checks

2017-07-18 Thread Dan Carpenter
On Mon, Jul 17, 2017 at 08:47:25PM -0400, Jacob von Chorus wrote: > -static void readinfo_bitstream(char *bitdata, char *buf, int *offset) > +static int readinfo_bitstream(char *bitdata, char *buf, int size, int > *offset) > { > char tbuf[64]; > s32 len; > @@ -59,9 +59,15 @@ static

Re: [PATCH v2 1/2] staging: gs_fpgaboot: add buffer overflow checks

2017-07-18 Thread Greg Kroah-Hartman
On Mon, Jul 17, 2017 at 08:47:25PM -0400, Jacob von Chorus wrote: > Four fields in struct fpgaimage are char arrays of length MAX_STR (256). > The amount of data read into these buffers is controlled by a length > field in the bitstream file read from userspace. If a corrupt or > malicious

[PATCH v2 1/2] staging: gs_fpgaboot: add buffer overflow checks

2017-07-17 Thread Jacob von Chorus
Four fields in struct fpgaimage are char arrays of length MAX_STR (256). The amount of data read into these buffers is controlled by a length field in the bitstream file read from userspace. If a corrupt or malicious firmware file was supplied, kernel data beyond these buffers can be overwritten