[PATCH libdrm] xf86drm: fix null termination of string buffer

Emil Velikov emil.l.velikov at gmail.com
Wed Dec 14 03:23:38 UTC 2016


Hi Taro Yamada,

On 13 December 2016 at 11:18,  <archer_ame at yahoo.co.jp> wrote:
> From: Taro Yamada <archer_ame at yahoo.co.jp>
>
> The string written to the buffer by read() is not null-terminated,
> but currently drmParsePciBusInfo() places null character only at the end of the buffer, not at the end of the
> string.
> As a result, the string passed to sscanf() contains an uninitialized value.
>
> This patch changes to places null character at the end of the string.
>
Did you see this causing issues in practise ?

We use a combination of strstr to strip any unwanted starting data,
and sscanf which [should] trim any trailing garbage.
That aside, your patch provides an extra bit of robustness which is
always nice ^_^

Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

Barring any objections I'll commit this in a few days.

Thanks
Emil


More information about the dri-devel mailing list