Re: [Intel-gfx] [PATCH libdrm] xf86drm: Bound strstr() to the allocated data

2016-01-25 Thread Dave Gordon
On 22/01/16 14:48, Ville Syrjälä wrote: On Fri, Jan 22, 2016 at 12:51:23PM +, Damien Lespiau wrote: We are reading at most sizeof(data) bytes, but then data may not contain a terminating '\0', at least in theory, so strstr() may overflow the stack allocated array. Make sure that data

[Intel-gfx] [PATCH libdrm] xf86drm: Bound strstr() to the allocated data

2016-01-22 Thread Damien Lespiau
We are reading at most sizeof(data) bytes, but then data may not contain a terminating '\0', at least in theory, so strstr() may overflow the stack allocated array. Make sure that data always contains at least one '\0'. Signed-off-by: Damien Lespiau --- xf86drm.c | 3

Re: [Intel-gfx] [PATCH libdrm] xf86drm: Bound strstr() to the allocated data

2016-01-22 Thread Ville Syrjälä
On Fri, Jan 22, 2016 at 12:51:23PM +, Damien Lespiau wrote: > We are reading at most sizeof(data) bytes, but then data may not contain > a terminating '\0', at least in theory, so strstr() may overflow the > stack allocated array. > > Make sure that data always contains at least one '\0'. >

Re: [Intel-gfx] [PATCH libdrm] xf86drm: Bound strstr() to the allocated data

2016-01-22 Thread Damien Lespiau
On Fri, Jan 22, 2016 at 04:48:05PM +0200, Ville Syrjälä wrote: > On Fri, Jan 22, 2016 at 12:51:23PM +, Damien Lespiau wrote: > > We are reading at most sizeof(data) bytes, but then data may not contain > > a terminating '\0', at least in theory, so strstr() may overflow the > > stack allocated