[dpdk-stable] [PATCH] kvargs: fix crash when parsing an invalid token on FreeBSD

David Marchand david.marchand at redhat.com
Wed May 6 15:22:40 CEST 2020


On Wed, Apr 29, 2020 at 3:17 PM Olivier Matz <olivier.matz at 6wind.com> wrote:
>
> The behavior of strtok_r() is not the same between GNU libc and FreeBSD
> libc: in the first case, the context is set to "" when the last token is
> returned, while in the second case it is set to NULL.
>
> On FreeBSD, the current code crashes because we are dereferencing a NULL
> pointer (ctx1). Fix it by first checking if it is NULL. This works with
> both GNU and FreeBSD libc.
>
> Fixes: ffcf831454a9 ("kvargs: fix buffer overflow when parsing list")
> Cc: stable at dpdk.org
>
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>

Tested-by: Zhimin Huang <zhiminx.huang at intel.com>

Applied, thanks.

-- 
David Marchand



More information about the stable mailing list